Skip to content

Commit

Permalink
chore(): fixed error patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
Serhii-F-Braavos authored and avimak committed Mar 15, 2024
1 parent f77bbf0 commit b8646d1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
12 changes: 5 additions & 7 deletions repository/errors-default.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,11 @@
},
{
"matcher": "/Class with hash ClassHash.+.is not declared/",
"message": "Class with hash \"{{0}}\" is not declared",
"extractors": [
{
"matcher": "/StarkFelt\\(.*\\\\\"(.*)\\\\\"/",
"type": "hex"
}
]
"message": "Class with required hash is not declared"
},
{
"matcher": "/Entry point EntryPointSelector\\(StarkFelt\\(\\\\\"0x[0-9a-zA-Z]+\\\\\"\\)\\) not found in contract/",
"message": "Entry point not found in contract"
}
]
}
20 changes: 11 additions & 9 deletions scripts/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,18 @@ const validateErrorMatchers = (errorMatchers, _messageBase) => {
}
}

errorMatcher.extractors.forEach((extractor, extractorIdx) => {
try {
stringToRegExp(extractor.matcher);
} catch (e) {
errorsArray.push(
errorMessageBase +
`/extractors/${extractorIdx}/matcher contains invalid regExp`
);
(errorMatcher.extractors || []).forEach(
(extractor, extractorIdx) => {
try {
stringToRegExp(extractor.matcher);
} catch (e) {
errorsArray.push(
errorMessageBase +
`/extractors/${extractorIdx}/matcher contains invalid regExp`
);
}
}
});
);
});
});

Expand Down

0 comments on commit b8646d1

Please sign in to comment.