Throw an error if a method is redeclared

`ApiError` is inherited from `Error`. I can prune this line from the test. Line 25 is sufficient for the test.