Creates an instance of InternalServerError
.
A message intended for server-side logging, which helps identify the issue internally.
The underlying error object that triggered this server error.
The HTTP status code for the error. In this case, 500 represents an internal server error.
Optional
stackStatic
Optional
prepareOptional override for formatting stack traces
Static
stackSerializes the error details into an array of BaseServiceError
objects.
This method is responsible for transforming the error into a user-friendly format that can be returned to the client or used in API responses. The default implementation returns a generic 500 error response.
An array containing a single BaseServiceError
object with:
code
: The HTTP status code (500).type
: The error type ("InternalServerError").message
: A user-friendly message indicating that something went wrong internally.Converts the error object into a standardized JSON structure.
errors
with the serialized errors.Static
capture
Represents a generic server error, by default a 500 Internal Server Error.
This class extends the abstract
ServiceError
class and is used to handle generic internal server-side errors. It can also be extended to define more specific server-side error classes (e.g. Server is down for maintenance).The
InternalServerError
class provides a default implementation for theserializeErrors
method, which returns a generic internal server error response.InternalServerError