Skip to content

Commit

Permalink
Raise exception in method view() {.base.}
Browse files Browse the repository at this point in the history
Close #170

Couldn't quite figure out a way to get the name of the derived `Viewable`, so I've decided to just give a generic error message here.
  • Loading branch information
madonuko authored Aug 23, 2024
1 parent 5ff93bc commit d20e706
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion owlkettle/widgetdef.nim
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ type

method build*(widget: Widget): WidgetState {.base.} = discard
method update*(widget: Widget, state: WidgetState): WidgetState {.base.} = discard
method view*(viewable: Viewable): Widget {.base.} = discard
method view*(viewable: Viewable): Widget {.base.} =
raise newException(Defect, "Unexpected call to `method view()`. Perhaps `method view(state: MyViewableState): Widget` for a `viewable MyViewable` is missing?")
method read*(state: WidgetState) {.base.} = discard
method assignApp*(widget: Widget, app: Viewable) {.base.} = discard

Expand Down

0 comments on commit d20e706

Please sign in to comment.