Handling errors in custom login handler

Hi all.

I’m writing own login method, authentication is handled via external app. The goal is to send credentials to external service, authenticate there and behave properly based on what happened. But this is not important. Problem is general.

So here is custom login client

Meteor.myCustomLogin =(login, password, callback) => {
  const loginRequest = {
    isCustomRequest: true,
    methodArguments: [loginRequest],
    userCallback: callback

And server side i register login handler :

Accounts.registerLoginHandler(loginRequest => {
  // login logic here 

  //and some error 
  if ( someCondition) {
    return {
      error : new Meteor.Error("error-code",'error-message');

Now, on the client lets call

Meteor.myCustomLogin(login,password, (err,res) => {
   console.log("Login error",err)

Regardless of what error is returned from registered login handler on client side error is always the same.

details: undefined
error: 500
errorType: "Meteor.Error"
isClientSafe: true
message: "Internal server error [500]"
reason: "Internal server error"

So, basically it seems error returned by login request is not properly passed through the internal logic.This is painful, because for example makes impossible to render proper login error message.