Skip to content

how to receive mirage's error msg on client #4

@siddo420

Description

@siddo420

On the client, is there any way I could access the error message/object that was returned by validator() method?

primus.id.validator(function validate(spark, fn) {
  if (spark.mirage === 'old') return fn(undefined, 'new');
  if (spark.mirage === 'new') return fn(undefined, 'old');

  fn(new Error('The id is neither new or old'));  //<--- how do I access this error object on client?
});

I am trying to make sure accounts are in a specific state but I need to know where/how validator function failed? I could have done it in authentication middleware but I can still not detect the error message there (or correct me if I am wrong).

I was thinking if we could have an event thrown on client something like 'mirage error' with this error object then that would solve this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions