Skip to content

Commit

Permalink
share: rethrow on album create error (pulsejet#1213)
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <[email protected]>
  • Loading branch information
pulsejet committed Jun 24, 2024
1 parent 47302b8 commit e22459a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/modal/ShareModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export default defineComponent({
await this.l(async () => {
// Create album using WebDAV
try {
await dav.createAlbum(name);
await dav.createAlbum(name, { rethrow: true });
} catch (e) {
showError(this.t('memories', 'Failed to create album for public link'));
return null;
Expand Down
3 changes: 2 additions & 1 deletion src/services/dav/albums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ export async function* removeFromAlbum(user: string, name: string, photos: IPhot
/**
* Create an album.
*/
export async function createAlbum(albumName: string) {
export async function createAlbum(albumName: string, opts?: { rethrow: boolean }) {
try {
await client.createDirectory(`/photos/${utils.uid}/albums/${albumName}`);
} catch (error) {
if (opts?.rethrow) throw error;
console.error(error);
showError(t('memories', 'Failed to create {albumName}.', { albumName }));
}
Expand Down

0 comments on commit e22459a

Please sign in to comment.