* Register all error templates with the FancyError class. * This is called after the Monogatari engine is loaded to ensure we use * the same FancyError instance that the engine uses. * @param FancyError
(FancyError)
| 18 | * @param FancyError |
| 19 | */ |
| 20 | function registerErrors(FancyError) { |
| 21 | // Canvas Action |
| 22 | FancyError.register('action:canvas:invalid_mode', { |
| 23 | title: 'The canvas mode provided ("{{mode}}") is not valid.', |
| 24 | message: 'Monogatari attempted to show a canvas object but the mode "{{mode}}" was not found in the canvas action configuration as a valid mode.', |
| 25 | props: { |
| 26 | 'Mode Provided': '{{mode}}', |
| 27 | 'You may have meant one of these': '{{validModes}}', |
| 28 | 'Statement': '{{statement}}', |
| 29 | 'Label': '{{label}}', |
| 30 | 'Step': '{{step}}', |
| 31 | 'Help': { |
| 32 | '_': 'Check your statement and make sure there are no typos on the mode you provided.' |
| 33 | } |
| 34 | } |
| 35 | }); |
| 36 | |
| 37 | FancyError.register('action:canvas:object_not_found', { |
| 38 | title: 'The canvas object "{{name}}" was not found or is invalid', |
| 39 | message: 'Monogatari attempted to retrieve an object named "{{name}}" but it didn\'t exist in the canvas objects.', |
| 40 | props: { |
| 41 | 'Canvas': '{{name}}', |
| 42 | 'You may have meant': '{{availableObjects}}', |
| 43 | 'Label': '{{label}}', |
| 44 | 'Step': '{{step}}', |
| 45 | 'Help': { |
| 46 | '_': 'Check the object\'s name is correct and that you have defined it previously. A canvas object is defined as follows:', |
| 47 | '_1': ` |
| 48 | <pre> |
| 49 | <code class='language-javascript'> |
| 50 | this.engine.action ('Canvas').objects ({ |
| 51 | stars: { |
| 52 | start: () => {}, |
| 53 | stop: () => {}, |
| 54 | restart: () => {}, |
| 55 | layers: [], |
| 56 | state: {}, |
| 57 | props: {} |
| 58 | } |
| 59 | }); |
| 60 | </code> |
| 61 | </pre> |
| 62 | `, |
| 63 | '_2': 'Notice the object defined uses a name or an id, in this case it was set to "stars" and to show it, you must use that exact name:', |
| 64 | '_3': ` |
| 65 | <pre><code class='language-javascript'>"show canvas stars background"</code></pre> |
| 66 | ` |
| 67 | } |
| 68 | } |
| 69 | }); |
| 70 | |
| 71 | // Dialog Action |
| 72 | FancyError.register('action:dialog:textbox_hidden', { |
| 73 | title: 'A dialog is being shown while the textbox is hidden', |
| 74 | message: 'Monogatari attempted to display a dialog but the textbox is currently hidden. The dialog will still be shown, but the player may not be able to see it.', |
| 75 | props: { |
| 76 | 'Statement': '{{statement}}', |
| 77 | 'Label': '{{label}}', |
no test coverage detected