Skip to content

Error handling

This page looks at different types of errors that can occur when using the FanPoints SDK.

Missing configuration

If the client is not properly configured, the promise is rejected with an Error error containing the details on why the configuration is faulty.

Request errors

Every operation on the FanPointsClient returns a promise with the result of the operation.

If an operation fails, the promise is rejected with an RequestError error. The RequestError object contains an attribute errors that is an array of the specific error codes that occurred during the operation:

import { createClient } from '@fanpoints/server-js';
const client = createClient({
// client configuration
});
client.statusPoints.undoAction('user_id', 'action_id').catch((error) => {
console.error('Thrown errors:', error.errors);
});