import * as alosaur from "https://deno.land/x/alosaur@v1.1.1/src/http-error/HttpError.ts"; ClassescHttpErrorUsed to throw HTTP errors. Just do throw new HttpError(code, message) in your controller action and default error handler will catch it and give in your response given code and message .