Skip to content

Commit 08ed451

Browse files
Updated example code
1 parent 527d4bf commit 08ed451

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ Example
3131
throw ono("%s is invalid. Must be at least %d characters.", username, minLength);
3232

3333
// Wrap and re-throw an error without losing the original error's message and stack
34-
throw ono(err, "Unable to save account #%d", accountNumber);
34+
throw ono(err, "An error occurred while saving your changes");
3535

3636
// Throw an error with custom properties (even a custom method!)
3737
throw ono({code: 413, status: "Invalid data", retry: function() {...}});
3838

3939
// Add custom properties to an existing Error
4040
throw ono(err, {code: 413, status: "Invalid data", retry: function() {...}})
4141

42-
// Any of the above can be throw a specific Error type
42+
// Any of the above can throw a specific Error subtype instead
4343
throw ono.range(...); // RangeError
4444
throw ono.syntax(...); // SyntaxError
4545
throw ono.reference(...); // ReferenceError

0 commit comments

Comments
 (0)