Management API returns 200 status code even when errors occur

When I try to create new users by Management API and some errors are happened, no errors occurred.
The API appears to be successful (the status code is 200).
2be44f60a097ca3d28697938963585b2

I can check the errors only in Monitoring > Logs section.

I expect the API to return a failure status code (like 400) when something goes wrong.
What should I do?

Hi @t.fukao

Welcome back to the Auth0 Community!

Can you provide steps to reproduce this issue?

Thanks
Dawid

Thank you, @dawid.matuszczyk !
I’ve found my own mistake.

I’m using Auth0 Laravel SDK.

        try {
            Auth0::management()
                ->users()
                ->create(
                    connection: 'Username-Password-Authentication',
                    body: [
                        'name' =>  $request->name,
                        'email' =>  $request->email,
                        'password' =>  $request->password,
                        'email_verified' => true, 
                    ]
                );
        } catch (\Exception $e) {
            logger($e->getMessage());
        }

I realized that the following information is missing from the catch section.

return ['Fail!', Response::HTTP_INTERNAL_SERVER_ERROR];

I’m sorry for my elementary mistake.

@dawid.matuszczyk
I have an additional question.
How can I get the error message (e.g., “The user already exists.”) in the catch section?

I’ve solved it.
https://community.auth0.com/t/how-can-i-catch-the-errors-of-management-api-in-laravel-sdk/146560/2