Skip to content

Commit

Permalink
update type, reject instead of throw err
Browse files Browse the repository at this point in the history
  • Loading branch information
pjaudiomv committed Feb 19, 2024
1 parent 3788143 commit e01b302
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/DataUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface Meeting {
export async function fetchData(query: string): Promise<any[]> {
try {
if (!query.includes('/client_interface/json')) {
throw new Error('Query does not contain a valid json endpoint.');
return Promise.reject(new Error('Query does not contain a valid json endpoint.'));
}
const updatedQuery = query.replace('/client_interface/json/', '/client_interface/jsonp/');
const response = await fetchJsonp(updatedQuery, {
Expand All @@ -30,7 +30,7 @@ export async function fetchData(query: string): Promise<any[]> {
});
const data = await response.json();
if (!Array.isArray(data) || data.length === 0) {
throw new Error('No data found');
return Promise.reject(new Error('No data found'));
}
return data;
} catch (error) {
Expand Down Expand Up @@ -110,7 +110,7 @@ function createPlacemark(meeting: Meeting): string {
`.trim();
}

function prepareSimpleLine(meeting: Meeting, withDate = true): string {
function prepareSimpleLine(meeting: Meeting, withDate: boolean = true): string {
const getLocationInfo = () => {
const locationInfo: string[] = [];
const addInfo = (property: keyof Meeting) => {
Expand Down

0 comments on commit e01b302

Please sign in to comment.