Errordactyl is a tool that automates HTTP endpoint testing and error handling for web servers in the Node.js and Deno runtime environment.
- Simple: Errordactyl utilizes a configuration file to store all route endpoints and their associated HTTP methods, making it easy to access or modify custom routes.
- Easy-to-run: Errordactyl encapsulates its functionality into minimalist command line interface commands, allowing for a painless setup and execution.
- Readable: Compiled error data gets returned from the error stream as a JSON object with elegant formatting to ensure error readability.
Suppose we have following example of a route built using Oak.js listening for requests from port 3000. An exception is thrown on purpose in order to test the error handling functionality of the tool.
import { Router } from 'https://deno.land/x/[email protected]/mod.ts';
const router = new Router();
router.get('/', (ctx) => {
ctx.response.body = "Get Request";
throw new EvalError;
});
When running our tool for the first time, running the edact init
command will generate a configuration file in a step-by-step process in the command line to determine endpoints and setup the starting configuration file, while considering pre-existing conditions such as existing configuration files and server paths.
edact init
After the initial setup is complete and a configuration file is generated, compile your executable bash script by passing the edact -f
command to populate the file with all of the endpoint routes, following any instructions the CLI outputs to the user.
edact -f
Now that all of the files have been generated, it is time to test your server. Back in our CLI, we would run the simple edact
command to invoke our generated shell script, testing all of the detected endpoints from the configuration file.
edact
The generated output from the CLI would be:
[
{
message: "[uncaught application error]: Error - ",
request: { url: "http://localhost:3000/", method: "GET", hasBody: false },
response: { status: 200, type: undefined, hasBody: true, writable: true },
location: "/Users/Ernietheerrordactyl/Documents/test/server/routes/router.ts",
lineNo: 7,
colNo: 11
}
]
The output error data is returned as a JSON object, writing all of the error stack trace data into a readable format.
The main purpose of this repository is to provide a general overview of the architecture of the application. Development of the tool is ongoing and we are open to any contributions that may be provided from curious onlookers and users.