mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-01 17:39:39 +02:00
Use Predicate and FileSystem in final Effect cleanup
This commit is contained in:
parent
c40bd406f8
commit
976e7ecfc5
6 changed files with 164 additions and 32 deletions
|
|
@ -113,15 +113,12 @@ function withDefault(value: string | undefined, fallback: string): string {
|
|||
}
|
||||
|
||||
function toErrorMessage(value: unknown, fallback: string): string {
|
||||
if (value instanceof Error) {
|
||||
return value.message;
|
||||
}
|
||||
if (typeof value === "string" && value.length > 0) {
|
||||
if (Predicate.isString(value) && value.length > 0) {
|
||||
return value;
|
||||
}
|
||||
if (value !== null && typeof value === "object" && "message" in value) {
|
||||
const message = (value as { message?: unknown }).message;
|
||||
if (typeof message === "string" && message.length > 0) {
|
||||
if (Predicate.isObject(value) && Predicate.hasProperty(value, "message")) {
|
||||
const message = value.message;
|
||||
if (Predicate.isString(message) && message.length > 0) {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue