Skip to content

Commit

Permalink
Sentry stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
bhollis committed Jun 14, 2024
1 parent edb13ec commit 03c086c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/app/inventory/move-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ export function moveItemTo(
e instanceof DimError &&
(e.code === 'wrong-level' ||
e.code === 'no-space' ||
e.bungieErrorCode() === PlatformErrorCodes.DestinyCannotPerformActionAtThisLocation)
e.bungieErrorCode() === PlatformErrorCodes.DestinyCannotPerformActionAtThisLocation ||
e.bungieErrorCode() === PlatformErrorCodes.DestinyNoRoomInDestination ||
e.bungieErrorCode() === PlatformErrorCodes.DestinyItemNotFound)
) {
// don't report
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/app/inventory/store/d2-item-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ export function makeItem(
const perks = itemDef.perks.filter(
(p, i) =>
p.perkVisibility === ItemPerkVisibility.Visible &&
itemUninstancedPerks?.[i].visible !== false &&
itemUninstancedPerks?.[i]?.visible !== false &&
defs.SandboxPerk.get(p.perkHash)?.isDisplayable,
);
if (perks.length) {
Expand Down
8 changes: 6 additions & 2 deletions src/app/utils/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,18 @@ const options: BrowserOptions = {
}
if (e instanceof DimError) {
// Replace the (localized) message with our code
event.message = e.code;
let message = e.code;
if (e.bungieErrorCode()) {
message = `${message} (${e.bungieErrorCode()})`;
}
event.message = message;
// TODO: it might be neat to be able to pass attachments here too - such as the entire profile response!

// Do deeper surgery to overwrite the localized message with the code
if (event.exception?.values) {
for (const ex of event.exception.values) {
if (ex.value === e.message) {
ex.value = e.code;
ex.value = message;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/vendors/d2-vendors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export function toVendor(

const destinationHash =
typeof vendor?.vendorLocationIndex === 'number' && vendor.vendorLocationIndex >= 0
? vendorDef.locations[vendor.vendorLocationIndex].destinationHash
? vendorDef.locations[vendor.vendorLocationIndex]?.destinationHash ?? 0
: 0;
const destinationDef = destinationHash ? defs.Destination.get(destinationHash) : undefined;
const placeDef = destinationDef?.placeHash ? defs.Place.get(destinationDef.placeHash) : undefined;
Expand Down

0 comments on commit 03c086c

Please sign in to comment.