Permalink
Switch branches/tags
Nothing to show
Commits on Apr 25, 2016
  1. Cleaning up examples

    JedWatson committed Apr 25, 2016
  2. v1.0.4

    JedWatson committed Apr 25, 2016
  3. Updating license for 2016

    JedWatson committed Apr 25, 2016
  4. Updating dependencies

    JedWatson committed Apr 25, 2016
Commits on Jun 27, 2014
  1. v1.0.3

    JedWatson committed Jun 27, 2014
  2. Merge pull request #2 from bmoeskau/master

    JedWatson committed Jun 27, 2014
    Better Premailer server error handling
Commits on Jun 26, 2014
  1. Better Premailer server error handling

    bmoeskau committed Jun 26, 2014
    I've found that lately the Premailer server has been failing inconsistently, and the error message I was getting back from premailer-api was `SyntaxError: Unexpected token <` along with a stack trace. This was causing me to think I was passing invalid HTML as input. After debugging, I found out that in fact, this error is due to premailer-api's current error handling assuming the response is valid JSON.  In fact, (unfortunately) the response I'm getting from Premailer looks like this currently:
    
        <!DOCTYPE html>
        <html>
        <head>
          <meta name="viewport" content="width=device-width, initial-scale=1">
          <style type="text/css">
            html, body, iframe { margin: 0; padding: 0; height: 100%; }
            iframe { display: block; width: 100%; border: none; }
          </style>
        <title>Application Error</title>
        </head>
        <body>
          <iframe src="//s3.amazonaws.com/heroku_pages/error.html">
            <p>Application Error</p>
          </iframe>
        </body>
        </html>
    
    That is the `body` value being passed to `JSON.parse`, hence the unexpected token error. Obviously the error coming back from Premailer itself appears to be due to bad handling on their side, but I guess trying to deal with it in a sensible way is at least better than raising it as a misleading error from premailer-api.
    
    The suggested patch is ugly, but at least allows for clean reporting of what's going on to the end user of the lib.  Now, how to go about fixing the Premailer server....
Commits on Sep 23, 2013
  1. v1.0.2

    JedWatson committed Sep 23, 2013
  2. Docs update

    JedWatson committed Sep 23, 2013
  3. Merge pull request #1 from jbuck/parse-error

    JedWatson committed Sep 23, 2013
    Fix crash when JSON response fails to parse
Commits on Oct 23, 2012
  1. Spelling fix

    JedWatson committed Oct 23, 2012
  2. Version bump

    JedWatson committed Oct 23, 2012
  3. Documentation fix

    JedWatson committed Oct 23, 2012
Commits on Oct 22, 2012
  1. Updating package name

    JedWatson committed Oct 22, 2012
  2. Indentation fix

    JedWatson committed Oct 22, 2012
  3. Updated License and Credits

    JedWatson committed Oct 22, 2012
  4. Implemented option aliases

    JedWatson committed Oct 22, 2012
  5. Documentation udpate

    JedWatson committed Oct 22, 2012
  6. Initial version

    JedWatson committed Oct 22, 2012
  7. Initial commit

    JedWatson committed Oct 22, 2012