Mithril.js: [rewrite] Promise - console.error: Possible unhandled promise rejection

Created on 7 Dec 2016  路  7Comments  路  Source: MithrilJS/mithril.js

Hi,

I get this weird error message in my console and I don't know what to do with it. Here is how to reproduce it:

server.js

var http = require('http')
var server = http.createServer()
server.on('request', (req, res) => {
  res.writeHead(400, {
    'Access-Control-Allow-Origin': '*',
    'content-type': 'text/plain'
  })
  res.end('hi')
})
server.listen(3000)

client.html

<script>
  m.request({
    method: 'GET',
    url: 'http://localhost:3000'
  })
  .then(() => console.log('OK'))
  .catch((err) => console.log(err.message, 'totally not OK'))
</script>

output

totally-not-ok

As you can see I'm making HTTP request to a server that responds with a 400 status code. Then I'm handling the error in the catch error handler by printing it out to the console, and yet I'm still getting the console.error message on line 101 - Possible unhandled promise rejection. I'm not sure what to do with this error message.

Bug

All 7 comments

What version is this?

Latest rewirte branch from a few hours ago.

Here's the problem section. Should be easy to fix, even for those less familiar with the rewrite code base.

@isiahmeadows if it's easy, you could go ahead and do it (just sayin') :)

Fixed

Thanks to everyone involved :+1:

@lhorie I was kind of leaving it hanging in hopes for a potential new contributor. :wink:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mke21 picture mke21  路  3Comments

hadihammurabi picture hadihammurabi  路  4Comments

simov picture simov  路  4Comments

andraaspar picture andraaspar  路  4Comments

dhinesh03 picture dhinesh03  路  4Comments