Skip to content

Commit 1b4c6cb

Browse files
committed
Remove unnecessary try-catch around update, according to discussion
1 parent 6b946af commit 1b4c6cb

File tree

1 file changed

+3
-39
lines changed

1 file changed

+3
-39
lines changed

extra/Lamdera/Injection.hs

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -176,40 +176,6 @@ injections outputType =
176176

177177
previousVersion = show_ previousVersionInt
178178

179-
-- @TODO: Simplify once we know why there’s a try-catch.
180-
-- Kinda silly to match on outputType twice.
181-
runUpdate =
182-
case outputType of
183-
LamderaBackend ->
184-
-- @TODO: Add comment about why we are swallowing errors
185-
-- for non-lamdera runtime. Also, why explicitly catch errors?
186-
-- Bugsnag would catch them anyway?
187-
-- https://github.com/lamdera/compiler/commit/7bd9d403954c09f24bf0e57a86210e8e5c1a97ee
188-
[text|
189-
try {
190-
var pair = A2(update, msg, model);
191-
} catch(err) {
192-
if (isLamderaRuntime) bugsnag.notify(err);
193-
return;
194-
}
195-
|]
196-
197-
LamderaFrontend ->
198-
-- @TODO: Add comment about why we are swallowing errors
199-
[text|
200-
try {
201-
var pair = A2(update, msg, model);
202-
} catch(err) {
203-
return;
204-
}
205-
|]
206-
207-
-- LamderaLive or NotLamdera
208-
_ ->
209-
[text|
210-
var pair = A2(update, msg, model);
211-
|]
212-
213179
shouldProxy =
214180
onlyIf (outputType == LamderaLive)
215181
[text|
@@ -250,8 +216,7 @@ injections outputType =
250216
return;
251217
}
252218

253-
$runUpdate
254-
219+
var pair = A2(update, msg, model);
255220
stepper(model = pair.a, viewMetadata);
256221
_Platform_enqueueEffects(managers, pair.b, subscriptions(model));
257222
}
@@ -331,7 +296,7 @@ injections outputType =
331296
var serializeDuration, logDuration = null;
332297
var start = mtime();
333298

334-
$runUpdate
299+
var pair = A2(update, msg, model);
335300

336301
const updateDuration = mtime() - start;
337302
start = mtime();
@@ -520,8 +485,7 @@ injections outputType =
520485

521486
$shouldProxy
522487

523-
$runUpdate
524-
488+
var pair = A2(update, msg, model);
525489
stepper(model = pair.a, viewMetadata);
526490
_Platform_enqueueEffects(managers, pair.b, subscriptions(model));
527491
}

0 commit comments

Comments
 (0)