Skip to content

Commit fc38327

Browse files
lydellsupermario
authored andcommitted
Remove unnecessary try-catch around update, according to discussion
1 parent e52c882 commit fc38327

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
@@ -177,40 +177,6 @@ injections outputType =
177177

178178
previousVersion = show_ previousVersionInt
179179

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

443-
$runUpdate
444-
409+
var pair = A2(update, msg, model);
445410
stepper(model = pair.a, viewMetadata);
446411
_Platform_enqueueEffects(managers, pair.b, subscriptions(model));
447412
}
@@ -634,7 +599,7 @@ injections outputType =
634599
var serializeDuration, logDuration = null;
635600
var start = mtime();
636601

637-
$runUpdate
602+
var pair = A2(update, msg, model);
638603

639604
const updateDuration = mtime() - start;
640605
start = mtime();
@@ -823,8 +788,7 @@ injections outputType =
823788

824789
$shouldProxy
825790

826-
$runUpdate
827-
791+
var pair = A2(update, msg, model);
828792
stepper(model = pair.a, viewMetadata);
829793
_Platform_enqueueEffects(managers, pair.b, subscriptions(model));
830794
}

0 commit comments

Comments
 (0)