DEV Community

Cover image for Node.JS - Version 4.3 of Foal framework has been released
Loïc Poullain
Loïc Poullain

Posted on

Node.JS - Version 4.3 of Foal framework has been released

Version 4.3 of Foal is out!

As a reminder, Foal is a full-featured Node.JS framework for building web applications.

Better CLI ouput when script arguments are invalid

Previously, when executing foal run my-script with invalid arguments, the CLI would only display one error at a time.

For example, with the following schema and arguments, we would only get this error message:

export const schema = {
  type: 'object', 
  properties: {
    email: { type: 'string', format: 'email', maxLength: 2 },
    password: { type: 'string' },
    n: { type: 'number', maximum: 10 }
  },
  required: ['password']
};
Enter fullscreen mode Exit fullscreen mode
foal run my-script email=bar n=11
Enter fullscreen mode Exit fullscreen mode
Error: The command line arguments must match format "email".
Enter fullscreen mode Exit fullscreen mode

From version 4.3 onwards, the CLI logs all validation errors and with a more meaningful description.

Script error: arguments must have required property 'password'.
Script error: the value of "email" must NOT have more than 2 characters.
Script error: the value of "email" must match format "email".
Script error: the value of "n" must be <= 10.
Enter fullscreen mode Exit fullscreen mode

[Fix] the logger no longer throws an error in development when the client request is interrupted

Using the logger's dev format, Foal would occasionally throw the error TypeError: Cannot read properties of null.

This would occur when the connection with the client was lost, which happens, for example, when the React client server hotly reloads.

This version fixes this error.

This post was originally published on FoalTS blog

Top comments (2)

Collapse
 
rahu profile image
Rahul Kumawat

Nice

Collapse
 
loicpoullain profile image
Loïc Poullain

Thank you!