Skip to content

Commit a1fd272

Browse files
authored
Fix compilation error pattern matching (#1069)
1 parent 1b6d8d9 commit a1fd272

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/bindings/RescriptCompilerApi.res

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,31 +317,31 @@ module CompileFail = {
317317
let decode = (json): t => {
318318
open JSON
319319
switch json {
320-
| String(type_) =>
320+
| Object(dict{"type": String(type_)}) =>
321321
switch type_ {
322322
| "syntax_error" =>
323323
let locMsgs = switch json {
324-
| Object(dict{"erros": Array(errors)}) => errors->Array.map(LocMsg.decode)
325-
| _ => throw(Failure(`Failed to decode erros from syntax_error. ${__LOC__}`))
324+
| Object(dict{"errors": Array(errors)}) => errors->Array.map(LocMsg.decode)
325+
| _ => throw(Failure(`Failed to decode errors from syntax_error. ${__LOC__}`))
326326
}
327327
// TODO: There seems to be a bug in the ReScript bundle that reports
328328
// back multiple LocMsgs of the same value
329329
locMsgs->LocMsg.dedupe->SyntaxErr
330330
| "type_error" =>
331331
let locMsgs = switch json {
332-
| Object(dict{"erros": Array(errors)}) => errors->Array.map(LocMsg.decode)
333-
| _ => throw(Failure(`Failed to decode erros from type_error. ${__LOC__}`))
332+
| Object(dict{"errors": Array(errors)}) => errors->Array.map(LocMsg.decode)
333+
| _ => throw(Failure(`Failed to decode errors from type_error. ${__LOC__}`))
334334
}
335335
TypecheckErr(locMsgs)
336336
| "warning_error" =>
337337
let warnings = switch json {
338-
| Object(dict{"erros": Array(warnings)}) => warnings->Array.map(Warning.decode)
338+
| Object(dict{"errors": Array(warnings)}) => warnings->Array.map(Warning.decode)
339339
| _ => throw(Failure(`Failed to decode errors from warning_error. ${__LOC__}`))
340340
}
341341
WarningErr(warnings)
342342
| "other_error" =>
343343
let locMsgs = switch json {
344-
| Object(dict{"erros": Array(errors)}) => errors->Array.map(LocMsg.decode)
344+
| Object(dict{"errors": Array(errors)}) => errors->Array.map(LocMsg.decode)
345345
| _ => throw(Failure(`Failed to decode errors from other_error. ${__LOC__}`))
346346
}
347347
OtherErr(locMsgs)

0 commit comments

Comments
 (0)