Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show error on failure while getting distinct column values #1524

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/manifest/dbtProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@ export class DBTProject implements Disposable {
error,
{ column, model },
);
throw error;
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/webview_provider/altimateWebviewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export class AltimateWebviewProvider implements WebviewViewProvider {
this.sendResponseToWebview({
command: "response",
syncRequestId,
status: true,
data: response,
});
} catch (error) {
Expand All @@ -154,6 +155,7 @@ export class AltimateWebviewProvider implements WebviewViewProvider {
command: "response",
syncRequestId,
error: message,
status: false,
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { LoadingButton, OptionType, Select, Stack } from "@uicore";
import { useEffect, useState } from "react";
import { Control, Controller, UseFormSetValue } from "react-hook-form";
import { SaveRequest } from "../types";
import { panelLogger } from "@modules/logger";

interface Props {
control: Control<SaveRequest, unknown>;
Expand All @@ -24,23 +25,28 @@ const AcceptedValues = ({
const [isLoading, setIsLoading] = useState(false);
const getDistinctColumnValues = async () => {
setIsLoading(true);
const result = (await executeRequestInSync("getDistinctColumnValues", {
model: currentDocsData?.name,
column,
})) as string[] | undefined;
setIsLoading(false);
try {
const result = (await executeRequestInSync("getDistinctColumnValues", {
model: currentDocsData?.name,
column,
})) as string[] | undefined;

if (result?.length && values?.length) {
const items = ["Yes, overwrite", "Cancel"];
const response = await executeRequestInSync("showInformationMessage", {
infoMessage: "Overwrite the existing values?",
items,
});
if (response !== items[0]) {
return;
if (result?.length && values?.length) {
const items = ["Yes, overwrite", "Cancel"];
const response = await executeRequestInSync("showInformationMessage", {
infoMessage: "Overwrite the existing values?",
items,
});
if (response !== items[0]) {
return;
}
}
setValue("accepted_values", result);
} catch (e) {
panelLogger.error("Unable to get distinct values", e);
} finally {
setIsLoading(false);
}
setValue("accepted_values", result);
};

useEffect(() => {
Expand Down
Loading