Skip to content

Commit

Permalink
fix: rename error to loadError to avoid name clash with building foot…
Browse files Browse the repository at this point in the history
…print ee layer
  • Loading branch information
jenniferarnesen committed Mar 7, 2024
1 parent ed7b4b0 commit 933d017
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/components/layers/overlays/OverlayCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const OverlayCard = ({
isVisible,
layer: layerType,
isLoaded,
error,
loadError,
} = layer

const canEdit = layerType !== EXTERNAL_LAYER
Expand All @@ -66,11 +66,11 @@ const OverlayCard = ({
const canOpenAs = OPEN_AS_LAYER_TYPES.includes(layerType)

const getCardContent = () => {
if (error) {
if (loadError) {
return (
<div className={styles.noticebox}>
<NoticeBox error title={i18n.t('Failed to load layer')}>
<p>{error.message}</p>
<p>{loadError.message}</p>
</NoticeBox>
</div>
)
Expand Down Expand Up @@ -130,7 +130,7 @@ const OverlayCard = ({
}
: undefined
}
hasError={!!error}
hasError={!!loadError}
>
{getCardContent()}
</LayerCard>
Expand Down
4 changes: 2 additions & 2 deletions src/components/loaders/GeoJsonUrlLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ const GeoJsonUrlLoader = ({ config, onLoad }) => {

useEffect(() => {
geoJsonUrlLoader(config, engine, instanceBaseUrl).then((data) => {
if (data.error) {
if (data.loadError) {
loadFailedAlert.show({
msg: i18n.t(
'Failed to load layer "{{layername}}": {{message}}',
{
layername: data.name,
message: data.error.message || data.error,
message: data.loadError.message || data.loadError,
nsSeparator: '^^',
}
),
Expand Down
8 changes: 4 additions & 4 deletions src/loaders/geoJsonUrlLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ const geoJsonUrlLoader = async (layer, engine, instanceBaseUrl) => {
}

let geoJson
let error
let loadError

try {
geoJson = await fetchData(newConfig.url, engine, instanceBaseUrl)
} catch (err) {
error = err
loadError = err
}

const legend = {
Expand All @@ -99,14 +99,14 @@ const geoJsonUrlLoader = async (layer, engine, instanceBaseUrl) => {
...layer,
name: newConfig.name, // TODO - will be fixed by DHIS2-16088
legend,
data: (!error && buildGeoJsonFeatures(geoJson)) || [],
data: (!loadError && buildGeoJsonFeatures(geoJson)) || [],
config: newConfig,
featureStyle,
isLoaded: true,
isLoading: false,
isExpanded: true,
isVisible: true,
error,
loadError,
}
}

Expand Down

0 comments on commit 933d017

Please sign in to comment.