question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Routes with data enum throw error

See original GitHub issue
Overview of the issue

Having a route with a data element that contains an enum throws an error:

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { ErrorComponent } from './error.component';
import { ErrorPage } from './error.interfaces';

const routes: Routes = [
  {
    path:        '404',
    component:   ErrorComponent,
    data: {
      errorType: ErrorPage.PageNotFound, // <--- This throws the error
    }
  },
];

@NgModule({
  imports: [
    RouterModule.forChild(routes)
  ],
  exports: [
    RouterModule
  ]
})
export class ErrorRoutingModule {
}

Error:

[14:29:43] Analysing routes definitions and clean them if necessary Unhandled Rejection at: Promise { <rejected> InvalidOperationError: Expected to find an initializer.

Operating System, Node.js, npm, compodoc version(s)

OS: macOS 11.1 Node: v15.6.0 NPM: 7.4.0 compodoc: 1.1.11

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
csutorasrcommented, Jul 4, 2021

The issue also happening, if you use enum as a string for the path.

0reactions
MickLcommented, Oct 1, 2021

I am on 1.1.14 now, shows error in console:

[11:18:37] Error during generation of routes JSON file, maybe a trailing comma or an external variable inside one route.

Storybook is working anyway. Before the build stopped.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enum.values() not working in GWT throws compilation error
Got it fixed by adding the Enum class package under source path="" in gwt.xml. <source path='myapplication/enums/'/>.
Read more >
Error handling - Apollo GraphQL Docs
For example, it throws a GRAPHQL_VALIDATION_FAILED error whenever an incoming operation isn't valid against the server's schema. Your resolvers can also throw ......
Read more >
Unreasonable warning for enum-based switch statements
TYPE_PARAMETER gets added, then a processor may choose to clean up and then do nothing, or it may choose to throw an exception....
Read more >
CWE-209: Generation of Error Message Containing Sensitive ...
The software generates an error message that includes sensitive information about its environment, users, or associated data. + Extended Description. The ...
Read more >
Best Practices for Node.js Error-handling - Toptal
Programmer errors represent unexpected bugs in poorly written code. They mean the code itself has some issues to solve and was coded wrong....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found