Skip to content
Merged
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
4 changes: 1 addition & 3 deletions functions/src/data/place/get/places/GetPlacesRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ async function _GetPlacesFromGoogle(

}

const data = await response.json()

throw new Error(data)
throw new Error(response.statusText)

} catch (error) {
throw error
Expand Down
5 changes: 3 additions & 2 deletions functions/src/domain/place/get/places/GetPlacesUsecase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ export async function GetPlacesUsecase(request: GetPlacesUsecaseRequest | string

try {

const resultSurcharges = await GetSurchargesRepository(resultPlaceIds)
const franchisesNames = await GetFranchiseRepository()
const [resultSurcharges, franchisesNames] = await Promise.all(
[GetSurchargesRepository(resultPlaceIds), GetFranchiseRepository()]
)

const placesWithSurcharges = resultPlaces.places.map((place) => {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,15 @@ export const getPlacesInterface = async (request: express.Request, response: Res
})

} catch (error: unknown) {

if (error instanceof Error) {
if (error.message === "User location is out of New Zealand") {
response.status(403).send({ message: error.message })
return
}
}
response.status(500).send({ message: error })

response.status(404).send()

}
}