api
Members list
Packages
Type members
Classlikes
Provides error handling for HTTP routes in a standardised way.
Provides error handling for HTTP routes in a standardised way.
The ErrorHandler wraps existing HTTP routes and ensures that:
NotFounderrors return a404status with a JSON-encodedErrorResponse.- Validation errors (e.g.,
IllegalArgumentException) return a400status. - Unexpected errors return a
500status with a generic message.
This utility promotes consistent error handling across the application.
Attributes
- Source
- ErrorHandler.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ErrorHandler.type
Represents a standard error response returned by the server in JSON format.
Represents a standard error response returned by the server in JSON format.
This case class is used to encapsulate error details, making it easy to serialise into a consistent JSON structure for HTTP error responses.
Value parameters
- error
-
A string identifying the type of error (e.g., "NotFound", "BadRequest").
- message
-
A descriptive message providing additional details about the error.
Attributes
- Source
- ErrorHandler.scala
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A utility class for constructing and starting an HTTP server.
A utility class for constructing and starting an HTTP server.
This class uses the EmberServerBuilder to set up a server with the provided HTTP routes. It integrates error handling for routes and ensures the server is properly managed as a Resource, allowing safe startup and shutdown.
Value parameters
- routes
-
The HTTP routes to be served by the server.
Attributes
- Source
- ServerBuilder.scala
- Supertypes
-
class Objecttrait Matchableclass Any