Houdini 20.5 hwebserver

hwebserver.APIError class

Raise this exception in apiFunction handlers to indicate an error.

If an apiFunction handler raises this exception, the server will use hwebserver.errorResponse to generate a 422 Unprocessable Entity response with a JSON Object body containing an error key with the given error message.

Any other kind of exception in a handler function will generate a generic 500 Internal Server Error. If the server is running in debug mode, the response body will contain a stack trace.

Note

webapiclient.py also has an APIError exception class. If an API function raises an APIError exception from the server, webapiclient will also raise an APIError from the client. If an API function on the server raises another exception and returns 500, webapiclient will also raise APIerror with the contents of the 500 response. You can access api_error.status_code from the client to differentiate between 422 and 500 errors.

Methods

hwebserver

Classes

Starting and Stopping

Handling Web Requests and Returning Responses

WebSocket

  • WebSocket

    Base class for WebSocket support with the embedded server.

  • hwebserver.webSocket

    Decorator for registering WebSocket classes with Houdini’s web server.

API Calls

  • hwebserver.apiFunction

    Decorator for functions that can be called through an API endpoint on Houdini’s web server, returning JSON or binary responses.

  • hwebserver.APIError

    Raise this exception in apiFunction handlers to indicate an error.