I have a code structure like this:
class CustomError {
  constructor(status, error = null, message = null) {
    this.status = status;
    this.error = error;
    this.message = message;
  }
}
const foo = async function() {
  throw new CustomError('foo error');
}
const bar = async function() {
  try {
    foo();
  } catch (error) {
    if (error instanceof CustomError) {
      throw error;
    }
    throw new CustomError('bar error');
  }
}
bar();
This throws bar error.
I placed this before the if statement: 
console.log(error instanceof CustomError, error)
which logs: 
false
CustomError {status: "foo", message: null, error: null}
this seems contradictory. If it logs error as CustomError shouldn't error instanceof CustomError return true?
