Skip to content

A platform for community discussion. Free, open, simple.

FIX: Avoid `undefined is not an object` errors (#38349)

Jarek Radoszdfddeca89c09
diff --git a/frontend/discourse/app/controllers/exception.js b/frontend/discourse/app/controllers/exception.js
index 0f66260fdc3..fcb46f4c984 100644
--- a/frontend/discourse/app/controllers/exception.js
+++ b/frontend/discourse/app/controllers/exception.js
@@ -61,7 +61,7 @@ export default class ExceptionController extends Controller {
@computed("isNetwork", "thrown.status", "thrown")
get reason() {
- if (this.thrown.reason) {
+ if (this.thrown?.reason) {
return this.thrown.reason;
} else if (this.isNetwork) {
return i18n("errors.reasons.network");
@@ -87,7 +87,7 @@ export default class ExceptionController extends Controller {
"thrown"
)
get desc() {
- if (this.thrown.desc) {
+ if (this.thrown?.desc) {
return this.thrown.desc;
} else if (this.networkFixed) {
return i18n("errors.desc.network_fixed");