Skip to content

Commit 49b5046

Browse files
committed
detect auth error for quarto pub
1 parent 2c23b8e commit 49b5046

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/publish/quarto-pub/quarto-pub.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
import { handlePublish, PublishHandler } from "../common/publish.ts";
2222
import { PublishOptions, PublishRecord } from "../types.ts";
2323

24-
import { QuartoPubClient } from "./api/index.ts";
24+
import { ApiError, QuartoPubClient } from "./api/index.ts";
2525
import { authorizePrompt } from "../account.ts";
2626
import { quartoConfig } from "../../core/quarto.ts";
2727

@@ -177,10 +177,10 @@ function publish(
177177
return handlePublish(handler, type, title, slug, render, target);
178178
}
179179

180-
function isUnauthorized(_err: Error) {
181-
return false;
180+
function isUnauthorized(err: Error) {
181+
return err instanceof ApiError && err.status === 401;
182182
}
183183

184-
function isNotFound(_err: Error) {
185-
return false;
184+
function isNotFound(err: Error) {
185+
return err instanceof ApiError && err.status === 404;
186186
}

0 commit comments

Comments
 (0)