mirror of
https://github.com/HeyPuter/puter.git
synced 2026-07-08 08:12:15 +00:00
fix: some error handling (#3190)
This commit is contained in:
@@ -146,7 +146,10 @@ export class ImageGenerationDriver extends PuterDriver {
|
||||
await this.#assertWriteAccess(actor, resolvedOutputPath);
|
||||
}
|
||||
|
||||
let modelId = args.model?.trim().toLowerCase();
|
||||
let modelId =
|
||||
typeof args.model === 'string'
|
||||
? args.model.trim().toLowerCase()
|
||||
: undefined;
|
||||
let intendedProvider =
|
||||
args.provider ?? (Context.get('driverName') as string | undefined);
|
||||
|
||||
|
||||
@@ -1704,8 +1704,10 @@ export class FSEntryStore extends PuterStore {
|
||||
for (const entry of userEntries) {
|
||||
const parentEntry = parentByPath.get(entry.parentPath);
|
||||
if (!parentEntry) {
|
||||
throw new Error(
|
||||
`Failed to resolve parent directory for ${entry.targetPath}`,
|
||||
throw new HttpError(
|
||||
404,
|
||||
`Parent directory not found for ${entry.targetPath}`,
|
||||
{ legacyCode: 'dest_does_not_exist' },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1857,8 +1859,10 @@ export class FSEntryStore extends PuterStore {
|
||||
for (const entry of insertChunk) {
|
||||
const parentEntry = parentByPath.get(entry.parentPath);
|
||||
if (!parentEntry) {
|
||||
throw new Error(
|
||||
`Failed to resolve parent directory for ${entry.targetPath}`,
|
||||
throw new HttpError(
|
||||
404,
|
||||
`Parent directory not found for ${entry.targetPath}`,
|
||||
{ legacyCode: 'dest_does_not_exist' },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1989,8 +1993,10 @@ export class FSEntryStore extends PuterStore {
|
||||
for (const entry of racedCandidates) {
|
||||
const parentEntry = parentByPath.get(entry.parentPath);
|
||||
if (!parentEntry) {
|
||||
throw new Error(
|
||||
`Failed to resolve parent directory for ${entry.targetPath}`,
|
||||
throw new HttpError(
|
||||
404,
|
||||
`Parent directory not found for ${entry.targetPath}`,
|
||||
{ legacyCode: 'dest_does_not_exist' },
|
||||
);
|
||||
}
|
||||
const existing = racedExistingByPath.get(entry.targetPath);
|
||||
|
||||
Reference in New Issue
Block a user