Skip to main content
Sales Support

Return a better error message when an API call is made to a nation, endpoint that does not exist

When making an API call to an invalid endpoint the response returns the HTML from a 404 page. A response body describing the issue (endpoint does not exist, nation does not exist) along with a 404 status would be preferred for debugging issues.


[17] pry(main)>"foo", "bar").call(:donations, :index)
NationBuilder::ClientError: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="" xml:lang="en" lang="en">

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>404 Error: The page you were looking for doesn't exist</title>
<style type="text/css">
body {
background: url( repeat top left;
color: #fff;
font-family: Lucida Grande, Lucida Sans Unicode, Garuda, sans-serif;
margin: 15px 0;
font-size: 1em;
#wrapper {
padding: 15px 0 0 45px;
#headline {
font-size: 2em;
font-weight: bold;
text-shadow: -1px -1px #333;
color: yellow;
#description {
font-size: 1.3em;
line-height: 1.8em;
color: #fff;
text-shadow: -1px -1px #333;
#footer {
clear: both;
font-size: 0.8em;
a:link, a:active, a:visited {
color: #ec7c31;
text-decoration: none;
a:hover {
text-decoration: none;
background-color: #fee34c;
color: #000;
#road {
margin-top: 15px;

<!-- This file lives in public/404.html -->

<div id="road">

<div id="wrapper">
<div id="headline">We couldn't find the page you were looking for.</div>
<div id="description">You may have mistyped the address or the page may have moved.</div>
<div id="road"><img src="" width="952" height="404"></div>

from [...]/gems/nationbuilder-rb-1.5.0/lib/nationbuilder/client.rb:129:in `parse_response_body'


Official response from

This is something we will consider but does not have a timeline at the moment.

Share this post

Showing 1 reaction

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.