fix hook error handling in .buildType()