Skip to content

Commit

Permalink
Getting bookmarked path now returns null
Browse files Browse the repository at this point in the history
Rather than throw error, as before.

If the bookmarked path doesn't exist, allow the consumer to recover however they choose without having to use  a try block
  • Loading branch information
jsloat committed Sep 25, 2023
1 parent 3917ffd commit b895bfe
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,8 @@ export const fade = (color: Color, change = 0.4) =>

export const getBookmarkedPath = (bookmarkName: string) => {
const f = FileManager.iCloud();
if (!f.bookmarkExists(bookmarkName))
throw new Error(
`File bookmark "${bookmarkName}" doesn't exist on this device.`
);
return f.bookmarkedPath(bookmarkName);
// File bookmark doesn't exist on this device.
return f.bookmarkExists(bookmarkName) ? f.bookmarkedPath(bookmarkName) : null;
};

export class ErrorWithPayload extends Error {
Expand Down

0 comments on commit b895bfe

Please sign in to comment.