Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export const mappedIcons = {
'accessibility': 59874,
'add': 59872,
'administration': 59662,
accessibility: 59874,
add: 59872,
administration: 59662,
'adobe-reader-monochromatic': 59663,
'airplane': 59815,
airplane: 59815,
'all-contacts-in-channels': 59664,
'all-contacts-in-queue': 59665,
'apple-monochromatic': 59666,
'apps': 59667,
apps: 59667,
'arrow-back': 59668,
'arrow-collapse': 59669,
'arrow-decrease': 59670,
Expand All @@ -22,30 +22,30 @@ export const mappedIcons = {
'arrow-right': 59838,
'arrow-up': 59680,
'arrow-up-box': 59679,
'attach': 59676,
'auditing': 59684,
'auth': 59685,
'avatar': 59686,
'backspace': 59687,
'basketball': 59776,
'bold': 59688,
'book': 59689,
'burger': 59813,
'business': 59690,
'calendar': 59691,
attach: 59676,
auditing: 59684,
auth: 59685,
avatar: 59686,
backspace: 59687,
basketball: 59776,
bold: 59688,
book: 59689,
burger: 59813,
business: 59690,
calendar: 59691,
'camera-disabled': 59692,
'camera-filled': 59693,
'camera-photo': 59694,
'camera-unavailable': 59695,
'canned-response': 59697,
'card': 59698,
card: 59698,
'channel-auto-join': 59746,
'channel-move-to-team': 59747,
'channel-private': 59699,
'channel-public': 59700,
'chat-close': 59701,
'chat-forward': 59702,
'check': 59703,
check: 59703,
'check-double': 59875,
'check-single': 59876,
'checkbox-checked': 59654,
Expand All @@ -56,178 +56,178 @@ export const mappedIcons = {
'chevron-right': 59707,
'chevron-up': 59708,
'circle-check': 59709,
'clipboard': 59710,
'clock': 59711,
'close': 59712,
clipboard: 59710,
clock: 59711,
close: 59712,
'cloud-connectivity': 59713,
'code': 59714,
code: 59714,
'code-block': 59840,
'contacts': 59715,
'copy': 59716,
'create': 59717,
'dashboard': 59718,
'delete': 59719,
'desktop': 59720,
'dialpad': 59721,
'directory': 59648,
contacts: 59715,
copy: 59716,
create: 59717,
dashboard: 59718,
delete: 59719,
desktop: 59720,
dialpad: 59721,
directory: 59648,
'directory-disabled': 59649,
'directory-error': 59650,
'discussions': 59722,
'document': 59723,
'donner': 59724,
'download': 59725,
'edit': 59726,
'emoji': 59729,
discussions: 59722,
document: 59723,
donner: 59724,
download: 59725,
edit: 59726,
emoji: 59729,
'emoji-bad-mood': 59727,
'emoji-neutral-mood': 59728,
'encrypted': 59730,
encrypted: 59730,
'engagement-dashboard': 59731,
'enterprise-feature': 59732,
'error-circle': 59873,
'facebook-monochromatic': 59733,
'federation': 59652,
federation: 59652,
'federation-disabled': 59651,
'file-document': 59734,
'file-sheet': 59735,
'filter': 59736,
'fingerprint': 59737,
'flag': 59738,
'folder': 59739,
'game': 59753,
filter: 59736,
fingerprint: 59737,
flag: 59738,
folder: 59739,
game: 59753,
'giphy-monochromatic': 59754,
'github-monochromatic': 59655,
'gitlab-monochromatic': 59656,
'glasses': 59812,
glasses: 59812,
'google-drive-monochromatic': 59756,
'google-monochromatic': 59657,
'group-by-type': 59757,
'hamburguer': 59758,
hamburguer: 59758,
'hash-shield': 59878,
'history': 59759,
'home': 59760,
'ignore': 59740,
'image': 59761,
'info': 59762,
history: 59759,
home: 59760,
ignore: 59740,
image: 59761,
info: 59762,
'input-clear': 59763,
'instance': 59764,
'italic': 59765,
instance: 59764,
italic: 59765,
'jump-backward': 59766,
'jump-forward': 59767,
'jump-to-message': 59768,
'kebab': 59769,
'keyboard': 59770,
kebab: 59769,
keyboard: 59770,
'lamp-bulb': 59836,
'language': 59771,
'leaf': 59814,
'link': 59752,
language: 59771,
leaf: 59814,
link: 59752,
'linkedin-monochromatic': 59658,
'live': 59774,
live: 59774,
'live-streaming': 59773,
'livechat-monochromatic': 59775,
'loading': 59844,
loading: 59844,
'lock-filled': 59748,
'locker': 59749,
locker: 59749,
'log-view': 59778,
'login': 59779,
'logout': 59780,
'mail': 59781,
'marketplace': 59782,
'meatballs': 59783,
'mention': 59784,
'message': 59786,
login: 59779,
logout: 59780,
mail: 59781,
marketplace: 59782,
meatballs: 59783,
mention: 59784,
message: 59786,
'message-disabled': 59785,
'meteor-monochromatic': 59659,
'mic': 59682,
mic: 59682,
'mic-off': 59681,
'mobile': 59789,
'moon': 59790,
mobile: 59789,
moon: 59790,
'move-to-the-queue': 59791,
'musical-note': 59792,
'new-window': 59793,
'notification': 59795,
notification: 59795,
'notification-disabled': 59794,
'omnichannel': 59796,
'order': 59797,
omnichannel: 59796,
order: 59797,
'ordering-ascending': 59798,
'ordering-descending': 59800,
'pause': 59803,
pause: 59803,
'pause-filled': 59802,
'pause-shape-filled': 59843,
'pause-shape-unfilled': 59880,
'percentage': 59777,
'phone': 59683,
percentage: 59777,
phone: 59683,
'phone-disabled': 59804,
'phone-in': 59809,
'phone-issue': 59879,
'phone-off': 59805,
'phone-question-mark': 59835,
'pin': 59808,
pin: 59808,
'pin-map': 59807,
'play': 59811,
play: 59811,
'play-filled': 59810,
'play-shape-filled': 59842,
'prune': 59817,
'queue': 59818,
'quote': 59819,
prune: 59817,
queue: 59818,
quote: 59819,
'radio-checked': 59855,
'radio-unchecked': 59867,
'reaction-add': 59820,
'record': 59821,
'refresh': 59822,
'rocket': 59816,
'search': 59823,
'send': 59825,
record: 59821,
refresh: 59822,
rocket: 59816,
search: 59823,
send: 59825,
'send-filled': 59824,
'settings': 59826,
'share': 59827,
'shield': 59661,
settings: 59826,
share: 59827,
shield: 59661,
'shield-alt': 59829,
'shield-check': 59828,
'signal': 59830,
'sms': 59772,
'sort': 59832,
signal: 59830,
sms: 59772,
sort: 59832,
'sort-az': 59831,
'star': 59834,
star: 59834,
'star-filled': 59833,
'stars': 59845,
stars: 59845,
'status-away': 59741,
'status-busy': 59742,
'status-disabled': 59837,
'status-loading': 59743,
'status-offline': 59744,
'status-online': 59745,
'strike': 59846,
strike: 59846,
'success-circle': 59869,
'sun': 59847,
'support': 59848,
'team': 59849,
sun: 59847,
support: 59848,
team: 59849,
'team-shield': 59877,
'teams': 59751,
teams: 59751,
'teams-private': 59750,
'text-format': 59839,
'threads': 59850,
'total': 59851,
'transcript': 59852,
threads: 59850,
total: 59851,
transcript: 59852,
'twitter-monochromatic': 59660,
'underline': 59853,
'undo': 59854,
underline: 59853,
undo: 59854,
'unread-on-top': 59857,
'unread-on-top-disabled': 59856,
'upload': 59858,
'user': 59861,
upload: 59858,
user: 59861,
'user-add': 59859,
'user-forward': 59860,
'video': 59696,
video: 59696,
'view-condensed': 59862,
'view-extended': 59863,
'view-medium': 59864,
'volume': 59806,
volume: 59806,
'volume-disabled': 59787,
'volume-off': 59788,
'waiting-on-me': 59865,
'warning': 59866,
warning: 59866,
'whatsapp-monochromatic': 59868,
'wordpress-monochromatic': 59755,
'workspaces': 59870,
'zip': 59871
};
workspaces: 59870,
zip: 59871
} as const;
8 changes: 0 additions & 8 deletions app/lib/methods/helpers/protectedFunction.js

This file was deleted.

8 changes: 8 additions & 0 deletions app/lib/methods/helpers/protectedFunction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default <T extends (...args: any[]) => any>(fn: T): ((...params: Parameters<T>) => void) =>
(...params: Parameters<T>) => {
try {
fn(...params);
} catch (e) {
console.log(e);
}
};
Comment on lines +1 to +8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Handle promise-returning callbacks too.

try/catch only covers synchronous throws. This helper is already used around an async stream handler in app/lib/services/connect.ts:153-166, so a rejection will bypass this catch and become an unhandled rejection. Based on learnings, this codebase expects floating promises to be handled explicitly.

♻️ Proposed fix
 export default <T extends (...args: any[]) => any>(fn: T): ((...params: Parameters<T>) => void) =>
 	(...params: Parameters<T>) => {
 		try {
-			fn(...params);
+			Promise.resolve(fn(...params)).catch((e) => {
+				console.log(e);
+			});
 		} catch (e) {
 			console.log(e);
 		}
 	};
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export default <T extends (...args: any[]) => any>(fn: T): ((...params: Parameters<T>) => void) =>
(...params: Parameters<T>) => {
try {
fn(...params);
} catch (e) {
console.log(e);
}
};
export default <T extends (...args: any[]) => any>(fn: T): ((...params: Parameters<T>) => void) =>
(...params: Parameters<T>) => {
try {
Promise.resolve(fn(...params)).catch((e) => {
console.log(e);
});
} catch (e) {
console.log(e);
}
};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/lib/methods/helpers/protectedFunction.ts` around lines 1 - 8, The
protectedFunction helper only catches synchronous exceptions, so
promise-returning callbacks can still reject unhandled. Update the wrapper in
protectedFunction to detect when fn returns a promise from the returned callback
and attach a rejection handler (or await it in an async wrapper) so both sync
throws and async rejections are handled; use the existing protectedFunction
symbol and keep the current logging behavior in the catch path.

Source: Learnings

File renamed without changes.