GALS API

Errors

Most controller actions return a JSON envelope produced by ApiResponseFactory rather than raw ASP.NET Problem Details.

Success envelope

<pre><code class="language-json">{ &quot;isSuccess&quot;: true, &quot;message&quot;: &quot;Contract has been saved successfully.&quot;, &quot;entity&quot;: { }, &quot;error&quot;: null }

Validation / domain error envelope

<pre><code class="language-json">{ &quot;isSuccess&quot;: false, &quot;message&quot;: &quot;Invalid contract data.&quot;, &quot;entity&quot;: &quot;Invalid contract data.&quot;, &quot;error&quot;: { &quot;code&quot;: &quot;...&quot;, &quot;message&quot;: &quot;...&quot; } }

Typical HTTP status mapping:

HTTP statusWhen
400 Bad RequestInvalid body, model state, or domain validation (InvalidDateException, ArgumentException, …)
401 UnauthorizedMissing or invalid Bearer token
403 ForbiddenAuthenticated but missing screen permission, or inactive employee
404 Not FoundResource missing (ApiResponseFactory.NotFound)
500 Internal Server ErrorUnexpected failures (ApiResponseFactory.ServerError)

Framework and EF exception text is scrubbed in ServerError responses so clients see a stable unexpected-error message instead of inner exception details.

Inactive employee middleware

PlatformAccessExceptionMiddleware catches InactiveEmployeeException after authentication and returns:

The portal shows an inactive-account message for this case.

Auth failure summary (portal behaviour)

ScenarioBackendPortal
No token401Redirect to /login
Valid token, no employeeAuto-provisions employeeContinues with /Employee/Me
Inactive employee403 + messageInactive account UI
Missing screen permission403Permission denied UI