felangel / mason

Tools which allow developers to create and consume reusable templates called bricks.
https://docs.brickhub.dev
986 stars 99 forks source link

fix: type 'Null' is not a subtype of type 'Object' #1069

Open lucavenir opened 1 year ago

lucavenir commented 1 year ago

Description

mason make crashes after the pre_gen hook, outputting "type 'Null' is not a subtype of type 'Object'". I am unable to debug or try to pinpoint this any better. The message says nothing on its own, and I am unable to understand what's going on.

So far I'm pretty sure my hooks aren't involved (pre-gen finishes correctly, post-gen isn't invoked since the crash happens before that).

I've tried my best to pinpoint the problem but I unluckily can't.

Steps To Reproduce I've got a full reproducible example.

  1. Go to this repo
  2. Clone it
  3. mason make riverpod_clean_feature_brick
  4. See error

Expected Behavior At least some explanation on why this crashed.

Additional Context I'm trying to make a riverpod - related feature brick, following an architecture that we've recently adopted

lucavenir commented 1 year ago

Update: after several hours, I was able to pinpoint the problem. An extra s to the word "service" was mistakenly added, inside brick.yaml.

Our controller file needs this parameter to generate its code, and because of its template the whole thing crashed. Removing the s solves the problem.

Should I leave this issue open because of the not-so-great error message?

felangel commented 1 year ago

Update: after several hours, I was able to pinpoint the problem. An extra s to the word "service" was mistakenly added, inside brick.yaml.

Our controller file needs this parameter to generate its code, and because of its template the whole thing crashed. Removing the s solves the problem.

Should I leave this issue open because of the not-so-great error message?

Glad you figured it out! Can you please share a minimal reproduction sample and I’m happy to improve the error, thanks!

lucavenir commented 1 year ago

minimal reproduction sample

Sure - you can use the repo linked above at this commit to reproduce this problem.