Skip to content

Symbol prop keys are not working #8

@adipascu

Description

@adipascu

Thank you for the great library!
I have a usecase with symbols that is not currently working, here is some sample code:

const ono = require('ono');

const SOME_PROP = Symbol('symbol-name');
// const SOME_PROP = 'string-key'; // (string keys work correctly)
function fun() {
  try {
    throw new Error('original error');
  } catch (e) {
    throw ono(e, { [SOME_PROP]: true }, 'wrapped with [SOME_PROP]');
  }
}

try {
  fun();
} catch (e) {
  console.log(`Has prop: ${e[SOME_PROP] || false}`);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions