| Conditions | 4 |
| Paths | 3 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | /** |
||
| 40 | let parse = (body) => { |
||
| 41 | try { |
||
| 42 | let { |
||
| 43 | "error": { |
||
| 44 | "message": message, |
||
| 45 | "stacktrace": stacktrace |
||
| 46 | } |
||
| 47 | } = body; |
||
| 48 | if (Array.isArray(stacktrace)) { |
||
|
|
|||
| 49 | message += `\n`; |
||
| 50 | for (let st of stacktrace) { |
||
| 51 | message += `\t${st.container}:${st.line}:${st.function}`; |
||
| 52 | } |
||
| 53 | let error = new CodingameError(message); |
||
| 54 | return Promise.reject(error); |
||
| 55 | } else { |
||
| 56 | throw `Stacktrace in the error should be an array`; |
||
| 57 | } |
||
| 58 | } catch(error) { |
||
| 59 | let message = `The body is not of response type '${name}'\n`; |
||
| 60 | message += error.message; |
||
| 61 | throw new Error(message); |
||
| 62 | } |
||
| 63 | }; |
||
| 64 | |||
| 69 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.