Error handling

I want to let know the user what type of error is having, but I don't know how metabase handle errors, I don't get a server status code, or timestap of some kind.

Hi @Kollerman
I don't understand what you mean. A little more context would be helpful.
Metabase provides error messages throughout the UI. Some errors are directly what the database reports, other errors are shown in a more human friendly form.

I'm using metabase API, so I want to tell the user to go log in if there is no Session Token stored, that is one example.

@Kollerman I don't know what you are doing, but have a look at how Metabase does it with /api/user/current
If you don't have authentication, then you'll get errors returned, which you could also use.

Yes I am replicating that error, my question is if there is more info in that error. The only thing I'm getting now is the auth error, but no status code of this error, for example, 4xx or 505. I want to detect if is an user error or a server error.

@Kollerman /api/user/current returns 401 status code.

Perfect but how do I access to that status code? I tried json.status and gives me undefined. Is an object? an array?

@Kollerman It's an HTTP status code.
Like I have already written: The best way to learn the API, is to just use Metabase while having your browser developer Network-tab open and looking at the request, and what data is being send/received.