Add controller for roleSchemas (unfinished)

+ Refine error messages for role schemas
+ Add role schema routes
+ Add RESULT_SCHEMA DataType
+ Add SchemaError.isSchemaError() type guard
This commit is contained in:
Stephan
2022-05-01 18:18:48 +02:00
parent 72ee918f00
commit 8384a3eebb
6 changed files with 154 additions and 2 deletions
+2 -2
View File
@@ -52,7 +52,7 @@ export function parseSchema(schema: any): DurationSchemaT | PointSchemaT {
const issue = e.issues.at(0);
if (issue) {
throw new SchemaError(`${issue.path}: ${issue.message}`);
throw new SchemaError(`Error with the schema: ${issue.path ? `${issue.path}:` : ""} ${issue.message}`);
}
throw new SchemaError("Unknown error occured while validating the schema");
@@ -61,5 +61,5 @@ export function parseSchema(schema: any): DurationSchemaT | PointSchemaT {
throw e;
}
throw new SchemaError("type must be either 'duration' or 'points'");
throw new SchemaError("Error with the schema: type must be either 'duration' or 'points'");
}