Search code examples
fantomafbedsheet

Why afBedSheet don't see my types?


I'm running a BedSheet application but when I make a HTTP request to a particular route, I get this error in the browser

500 - Internal Server Error
afBeanUtils::TypeNotFoundErr
- Could not find match for Type mypod::MyClass. 

Available Values

afBedSheet::FileAsset
afBedSheet::HttpStatus
afBedSheet::MethodCall
afBedSheet::Redirect
afBedSheet::Text
sys::File
sys::InStream

afBeanUtils::TypeNotFoundErr : Could not find match for Type mypod::MyClass.
  afBeanUtils::TypeLookup.check (TypeLookup.fan:157)
    afBeanUtils::TypeLookup.doFindParent (TypeLookup.fan:140)

However MyClass is there and it is being instantiated by other class. Why is not found?


Solution

  • That Err msg could be a little more informative...

    It sounds like your request handler is returning an instance of mypod::MyClass and BedSheet is complaining that it doesn't know what to do with it.

    You probably want to be returning an instance of afBedSheet::Text as in:

    Obj indexPage() {
      return Text.fromHtml("<html>Hello!</html>")
    }
    

    If the above doesn't sound right, then I'd need to see some code to be of further help.