Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1302,9 +1302,6 @@ function atob(input) {
throw lazyDOMException(
'The string to be decoded is not correctly encoded.',
'InvalidCharacterError');
case -3: // Possible overflow
// TODO(@anonrig): Throw correct error in here.
throw lazyDOMException('The input causes overflow.', 'InvalidCharacterError');
Comment on lines -1305 to -1307
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An unrecognised error state shouldn't be ignored.

I was thinking something like

    case -3:
      assert.fail('Unrecognized simdutf error');

with internal assert added to the imports in the script header:

@@ -97,10 +97,11 @@ const {
 } = require('internal/util/types');
 const {
   inspect: utilInspect,
 } = require('internal/util/inspect');

+const assert = require('internal/assert');
 const {
   codes: {
     ERR_BUFFER_OUT_OF_BOUNDS,
     ERR_INVALID_ARG_TYPE,
     ERR_INVALID_ARG_VALUE,

default:
return result;
}
Expand Down
Loading