Skip to content

Commit

Permalink
fix: [PROD-11969] minor improvements in error code display in SimpleP…
Browse files Browse the repository at this point in the history
…owerBIReportEmbed

 - allow status code without text (and vice-versa)
 - remove dash between status code and status text
  • Loading branch information
csm-thu committed Jul 25, 2023
1 parent e660eb4 commit 49afe5a
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/charts/SimplePowerBIReportEmbed/SimplePowerBIReportEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,12 @@ const useStyles = makeStyles((theme) => ({
}));

function getErrorCode(labels, reports) {
let errorCode = labels.errors.unknown;
if (reports?.error?.status && reports?.error?.statusText) {
errorCode = `${reports?.error?.status} - ${reports?.error?.statusText}`;
}
return errorCode;
if (!reports?.error?.status && !reports?.error?.statusText) return labels.errors.unknown;
return `${reports?.error?.status ?? ''} ${reports?.error?.statusText ?? ''}`;
}

function getErrorDescription(labels, reports) {
let errorDescription = labels.errors.details;
if (reports?.error?.powerBIErrorInfo) {
errorDescription = reports?.error?.powerBIErrorInfo;
}
return errorDescription;
return reports?.error?.powerBIErrorInfo ?? labels.errors.details;
}

function addDynamicParameters(pageName, lang, newConfig, settings, staticFilters, additionalFilters) {
Expand Down Expand Up @@ -256,6 +249,7 @@ export const SimplePowerBIReportEmbed = ({
</div>
);
};

SimplePowerBIReportEmbed.propTypes = {
/**
* Index of reportConfiguration
Expand Down

0 comments on commit 49afe5a

Please sign in to comment.