Skip to content

Instantly share code, notes, and snippets.

@ccapndave
Last active May 12, 2016 13:49
Show Gist options
  • Save ccapndave/0bbfcabcc290b19c4affc49d27a0c224 to your computer and use it in GitHub Desktop.
Save ccapndave/0bbfcabcc290b19c4affc49d27a0c224 to your computer and use it in GitHub Desktop.
TypeError: Cannot read property 'ctor' of undefined at Function.func (http://localhost:3000/js/Main.js:11594:16) at A3 (http://localhost:3000/js/Main.js:98:11) at Function.func (http://localhost:3000/js/Main.js:11781:16) at A2 (http://localhost:3000/js/Main.js:92:11) at Object.callback (http://localhost:3000/js/Main.js:1817:18) at step (http://localhost:3000/js/Main.js:2410:39) at work (http://localhost:3000/js/Main.js:2466:14)

The error is thrown in the default case in Javascript for the main case msg of bit of an update function (although the update function doesn't have an otherwise or _)

var _user$project$Page_ExercisePage$update = F3(
	function (context, msg, model) {
		update:
		while (true) {
			var _p6 = msg;
			switch (_p6.ctor) {
        // (lots of cases here)
				default:
					if (_p6._0.ctor === 'Dispatch') { // at this point the error occurs because _p6 is actually the number 1463060035425, not an object with a `ctor` or anything

This is happening in a component which has a Timer as a subcomponent. The subscriptions are being composed with:

subscriptions : Model -> Sub Msg
subscriptions model =
    Sub.batch
    [ ...
    , Timer.subscriptions model.timerModel |> Sub.map TimerMsg
    ]

and in the Timer there is:

subscriptions : Model -> Sub Msg
subscriptions model =
  Time.every 250 TimerTick

I think this is the only place that a number like 1463060035425 could be coming from. Note that the number isn't always exactly the same, although it is similar. The last three errors I logged had _p6 equal to:

  • 1463060035425
  • 1462955273589
  • 1462961265291
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment