mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-01 03:18:06 +03:00
I'm sorry for how disgustingly large all of these commits are. I promise that this is the last time something this disgusting will happen. This is a mono-patch for various things that were broken by the major refactor. It's mostly things like error messages now being different (and tests failing as a result). Some notable fixes include me accidentally deleting the entire DELETE api-tokens endpoint (lol), and timeAchieved: 0 in batch-manual not coercing to null anymore. It appears the behaviour was intentional for some reason. I'm not sure why though.
18 lines
596 B
TypeScript
18 lines
596 B
TypeScript
import p from "prudence";
|
|
import type { PrudenceError, ValidSchemaValue } from "prudence";
|
|
|
|
export function FormatPrError(err: PrudenceError, foreword = "Error") {
|
|
const receivedText =
|
|
typeof err.userVal === "object" && err.userVal !== null
|
|
? ""
|
|
: ` | Received ${err.userVal} [type: ${
|
|
err.userVal === null ? "null" : typeof err.userVal
|
|
}]`;
|
|
|
|
return `${foreword}: ${err.keychain ?? "null"} | ${err.message}${receivedText}.`;
|
|
}
|
|
|
|
export const optNull = (v: ValidSchemaValue) => p.optional(p.nullable(v));
|
|
|
|
export const optNullFluffStrField = optNull(p.isBoundedString(3, 140));
|