| 1 | package mapa |
| 2 | |
| 3 | // importFailure is a failure code's own sentence, never Notion's |
| 4 | // message (Notion import spec §8.4). The codes are the module's and |
| 5 | // Mapa's own; an unknown one is shown as the code. |
| 6 | func importFailure(code string) string { |
| 7 | if sentence, ok := importFailures[code]; ok { |
| 8 | return sentence |
| 9 | } |
| 10 | return "Failed (" + code + ")." |
| 11 | } |
| 12 | |
| 13 | var importFailures = map[string]string{ |
| 14 | "unauthorized": "Notion refused the integration's secret. It may " + |
| 15 | "have been removed in Notion: connect again with a new one.", |
| 16 | "rate_limited": "Notion kept asking Mapa to slow down. Resume or " + |
| 17 | "run it again later.", |
| 18 | "traversal_failed": "Notion's response couldn't be read to the end, " + |
| 19 | "so nothing was assumed. Run it again.", |
| 20 | "not_found": "Notion couldn't find it, or it isn't shared with " + |
| 21 | "the integration.", |
| 22 | "network": "Mapa couldn't reach Notion. Run it again.", |
| 23 | "forbidden_host": "A request went somewhere Mapa doesn't allow.", |
| 24 | "forbidden_method": "A request Mapa doesn't allow was refused.", |
| 25 | "too_large": "Notion's answer was too large to read.", |
| 26 | "render_failed": "Mapa couldn't copy its text exactly, so it " + |
| 27 | "wrote nothing.", |
| 28 | "write_failed": "Mapa couldn't save the page.", |
| 29 | "title_taken": "Every title Mapa tried was taken.", |
| 30 | "internal": "Something went wrong inside Mapa.", |
| 31 | "disconnected": "Ended when Mapa was disconnected from Notion.", |
| 32 | "finished": "Ended when the import was finished.", |
| 33 | "forgotten": "Ended when the import was forgotten.", |
| 34 | "started_over": "Ended when the import was started over.", |
| 35 | "idle": "Ended when Mapa deleted a secret unused for 90 days.", |
| 36 | } |
| 37 | |