-
Notifications
You must be signed in to change notification settings - Fork 8
/
alert.mjs
38 lines (32 loc) · 1.57 KB
/
alert.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* Copyright (C) 2023-2024 anonymous
This file is part of PSFree.
PSFree is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
PSFree is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
// We can't just open a console on the ps4 browser, make sure the errors thrown
// by our modules are alerted. We use alert() instead of debug_log() because
// while we are developing, we may modify the utils.mjs module and introduce
// bugs. We can not use debug_log() if it throws an error.
//
// We added this new file instead of putting this on run.mjs, so we can ensure
// we can attach this listener first before running anything.
addEventListener('unhandledrejection', (event) => {
const reason = event.reason;
// We log the line and column numbers as well since some exceptions (like
// SyntaxError) do not show it in the stack trace.
alert(
`${reason}\n`
+ `${reason.sourceURL}:${reason.line}:${reason.column}\n`
+ `${reason.stack}`
);
throw reason;
})
// important that we dynamically import the exploit script after we attach
import('./exploit.mjs');