Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Commit

Permalink
[DEV] Improve error management
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainCscn committed Apr 19, 2018
1 parent 841da7b commit 6c17a31
Show file tree
Hide file tree
Showing 72 changed files with 55,739 additions and 47,376 deletions.
4 changes: 2 additions & 2 deletions dist/myscript.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/myscript.min.js.map

Large diffs are not rendered by default.

51,235 changes: 27,978 additions & 23,257 deletions docs/ast/source/Editor.js.json

Large diffs are not rendered by default.

337 changes: 134 additions & 203 deletions docs/ast/source/recognizer/websocket/v4/Cdkv4WSBuilder.js.json

Large diffs are not rendered by default.

49,155 changes: 26,205 additions & 22,950 deletions docs/ast/source/recognizer/websocket/v4/Cdkv4WSIInkRecognizer.js.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
191 changes: 131 additions & 60 deletions docs/class/src/Editor.js~Editor.html

Large diffs are not rendered by default.

38 changes: 20 additions & 18 deletions docs/coverage.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"coverage": "91.53%",
"expectCount": 248,
"coverage": "90.8%",
"expectCount": 250,
"actualCount": 227,
"files": {
"src/model/RecognizerContext.js": {
Expand All @@ -9,19 +9,20 @@
"undocumentLines": []
},
"src/Editor.js": {
"expectCount": 59,
"expectCount": 60,
"actualCount": 53,
"undocumentLines": [
413,
408,
492,
442,
593,
594
425,
420,
504,
931,
454,
605,
606
]
},
"src/recognizer/websocket/v4/Cdkv4WSIInkRecognizer.js": {
"expectCount": 27,
"expectCount": 28,
"actualCount": 19,
"undocumentLines": [
98,
Expand All @@ -31,7 +32,8 @@
68,
204,
211,
218
218,
459
]
},
"src/renderer/canvas/symbols/MathSymbolCanvasRenderer.js": {
Expand Down Expand Up @@ -196,11 +198,6 @@
"actualCount": 1,
"undocumentLines": []
},
"src/renderer/canvas/symbols/StrokeSymbolCanvasRenderer.js": {
"expectCount": 1,
"actualCount": 1,
"undocumentLines": []
},
"src/renderer/svg/symbols/StrokeSymbolSVGRenderer.js": {
"expectCount": 1,
"actualCount": 1,
Expand All @@ -216,6 +213,11 @@
"actualCount": 2,
"undocumentLines": []
},
"src/renderer/canvas/symbols/StrokeSymbolCanvasRenderer.js": {
"expectCount": 1,
"actualCount": 1,
"undocumentLines": []
},
"src/callback/EventCallback.js": {
"expectCount": 1,
"actualCount": 1,
Expand All @@ -231,7 +233,7 @@
"actualCount": 3,
"undocumentLines": []
},
"src/recognizer/common/v3/Cdkv3CommonTextRecognizer.js": {
"src/recognizer/common/CdkCommonUtil.js": {
"expectCount": 1,
"actualCount": 1,
"undocumentLines": []
Expand All @@ -241,7 +243,7 @@
"actualCount": 4,
"undocumentLines": []
},
"src/recognizer/common/CdkCommonUtil.js": {
"src/recognizer/common/v3/Cdkv3CommonTextRecognizer.js": {
"expectCount": 1,
"actualCount": 1,
"undocumentLines": []
Expand Down
1,355 changes: 731 additions & 624 deletions docs/dump.json

Large diffs are not rendered by default.

23 changes: 20 additions & 3 deletions docs/file/src/Editor.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-pointerEvents">pointerEvents</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-redo">redo</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-resize">resize</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-restoreSession">restoreSession</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyle">setPenStyle</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyleClasses">setPenStyleClasses</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setTheme">setTheme</a></span></span></li>
Expand Down Expand Up @@ -428,18 +429,19 @@
const handleResult = (err, res, ...types) =&gt; {
if (err) {
logger.error(&apos;Error while firing the recognition&apos;, err.stack || err); // Handle any error from all above steps
if ((err.message === &apos;Wrong application key&apos;) || (err.message === &apos;Invalid HMAC&apos;) ||
if ((err.message === &apos;Invalid application key.&apos;) || (err.message === &apos;Invalid HMAC&apos;) ||
(err.error &amp;&amp;
err.error.result &amp;&amp;
err.error.result.error &amp;&amp;
(err.error.result.error === &apos;InvalidApplicationKeyException&apos; || err.error.result.error === &apos;InvalidHMACSignatureException&apos;)
)) {
editorRef.error.innerText = Constants.Error.WRONG_CREDENTIALS;
} else {
} else if (editorRef.error.style.display === &apos;none&apos;) {
editorRef.error.innerText = Constants.Error.NOT_REACHABLE;
}
if (err.message === &apos;Session is too old. Max Session Duration Reached&apos; &amp;&amp; RecognizerContext.canReconnect(editor.recognizerContext)) {
if ((err.message === &apos;Session is too old. Max Session Duration Reached&apos; || err.code === 1006) &amp;&amp; RecognizerContext.canReconnect(editor.recognizerContext)) {
logger.info(&apos;Reconnection is available&apos;, err.stack || err);
editorRef.error.style.display = &apos;none&apos;;
} else {
editorRef.error.style.display = &apos;initial&apos;;
triggerCallbacks(editor, err, Constants.EventType.ERROR, ...types);
Expand Down Expand Up @@ -487,6 +489,17 @@
editorRef.smartGuide = SmartGuide.launchSmartGuide(editor.smartGuide, exports);
}

function launchRestoreSession(editor, model) {
if (editor.recognizer &amp;&amp; editor.recognizer.restoreSession) {
editor.recognizerContext.initPromise
.then(() =&gt; {
editor.recognizer.restoreSession(editor.recognizerContext, model, editor.domElement, (err, res, ...types) =&gt; {
recognizerCallback(editor, err, res, ...types);
});
});
}
}

/**
* Launch ink import.
* @param {Editor} editor
Expand Down Expand Up @@ -1180,6 +1193,10 @@
launchImport(this, this.model, !(data instanceof Blob) ? new Blob([data], { type: mimetype }) : data);
}

restoreSession() {
launchRestoreSession(this, this.model);
}

/**
* pointer events
* @param {PointerEvents} events
Expand Down
1 change: 1 addition & 0 deletions docs/file/src/EditorFacade.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-pointerEvents">pointerEvents</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-redo">redo</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-resize">resize</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-restoreSession">restoreSession</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyle">setPenStyle</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyleClasses">setPenStyleClasses</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setTheme">setTheme</a></span></span></li>
Expand Down
1 change: 1 addition & 0 deletions docs/file/src/callback/EventCallback.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-pointerEvents">pointerEvents</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-redo">redo</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-resize">resize</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-restoreSession">restoreSession</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyle">setPenStyle</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyleClasses">setPenStyleClasses</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setTheme">setTheme</a></span></span></li>
Expand Down
1 change: 1 addition & 0 deletions docs/file/src/configuration/Constants.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-pointerEvents">pointerEvents</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-redo">redo</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-resize">resize</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-restoreSession">restoreSession</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyle">setPenStyle</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyleClasses">setPenStyleClasses</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setTheme">setTheme</a></span></span></li>
Expand Down
1 change: 1 addition & 0 deletions docs/file/src/configuration/DefaultBehaviors.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-pointerEvents">pointerEvents</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-redo">redo</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-resize">resize</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-restoreSession">restoreSession</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyle">setPenStyle</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyleClasses">setPenStyleClasses</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setTheme">setTheme</a></span></span></li>
Expand Down
1 change: 1 addition & 0 deletions docs/file/src/configuration/DefaultConfiguration.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-pointerEvents">pointerEvents</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-redo">redo</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-resize">resize</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-restoreSession">restoreSession</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyle">setPenStyle</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyleClasses">setPenStyleClasses</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setTheme">setTheme</a></span></span></li>
Expand Down
1 change: 1 addition & 0 deletions docs/file/src/configuration/DefaultPenStyle.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-pointerEvents">pointerEvents</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-redo">redo</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-resize">resize</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-restoreSession">restoreSession</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyle">setPenStyle</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyleClasses">setPenStyleClasses</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setTheme">setTheme</a></span></span></li>
Expand Down
1 change: 1 addition & 0 deletions docs/file/src/configuration/DefaultTheme.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-pointerEvents">pointerEvents</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-redo">redo</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-resize">resize</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-restoreSession">restoreSession</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyle">setPenStyle</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyleClasses">setPenStyleClasses</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setTheme">setTheme</a></span></span></li>
Expand Down
1 change: 1 addition & 0 deletions docs/file/src/configuration/LoggerConfig.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-pointerEvents">pointerEvents</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-redo">redo</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-resize">resize</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-restoreSession">restoreSession</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyle">setPenStyle</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyleClasses">setPenStyleClasses</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setTheme">setTheme</a></span></span></li>
Expand Down
1 change: 1 addition & 0 deletions docs/file/src/grabber/PointerEventGrabber.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-pointerEvents">pointerEvents</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-redo">redo</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-resize">resize</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-restoreSession">restoreSession</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyle">setPenStyle</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyleClasses">setPenStyleClasses</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setTheme">setTheme</a></span></span></li>
Expand Down
1 change: 1 addition & 0 deletions docs/file/src/model/InkModel.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-pointerEvents">pointerEvents</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-redo">redo</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-resize">resize</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-restoreSession">restoreSession</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyle">setPenStyle</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setPenStyleClasses">setPenStyleClasses</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-setTheme">setTheme</a></span></span></li>
Expand Down
Loading

0 comments on commit 6c17a31

Please sign in to comment.