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.

Improve error reporting and logging

See original GitHub issue

I had wrong imports of functions and wanted to use them in take(invalidMethod) and all I got was a mysterious invalid type error in the console. I did not know which saga it originated from. I understand that redux-saga cannot know where it comes from.

Therefore I am thinking maybe we can extend the saga steps with optional comments, that will help to improve error reporting.

yield log(take(WAIT_FOR_ACTION), "Waiting for action")
yield log(call(asyncFunc, withParams), "Calling async function")
yield log(put(SET_RESULT_ACTION), "Setting the result of the async call")

It would not break the existing API What you think?

Proposed implementation:

function *log(func, message) {
  console.log(message)
  yield func
}

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

11reactions
bolismaurocommented, Mar 3, 2016

I’m not sure if this is related to this issue but I’ve just started to work with sagas and I find almost impossible to debug saga code. The main issues I have are:

  • breakpoints basically don’t work (either they are not triggered, or functions like ‘next step’ behave in a weird way
  • when there is an exception inside a saga (or a function invoked using call inside a saga) nor the stack trace or the error message is meaningful

I’m using the latest version of Chrome but I’ve also tried Safari and Chrome. Most likely these issues are not directly related to redux-saga but I wonder if there is a way to support developers in the debugging process because right now I think it is really really hard

1reaction
yelouaficommented, Mar 5, 2016

@pke I think you can implement the log utility without involving the core. put, take, … are simple pure functions which return plain objects so you can just wrap them in whatever you want

function log(effect, message) {
  console.log(message)
  return effect
}

function* saga() {
  // will log then return the result of take
  yield log(take(WAIT_FOR_ACTION), "Waiting for action")
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Pump Up the Volume: Tips for Increasing Error Reporting and ...
Error -reporting systems continue to be an important tool for improving patient safety and often represent one of the primary means by which ......
Read more >
6 Ways To Make Error Logs Your New Secret Weapon
1. Don't treat all errors the same · 2. Make sure each error log provides context · 3. Monitor frequency next to the...
Read more >
Error Reporting documentation | Google Cloud
You can report errors from your application by sending them directly to Cloud Logging with proper formatting or by calling an Error Reporting...
Read more >
Error Reporting and error logging - YouTube
In this episode of Stack Doctor, Yuri Grinshteyn speaks to the multiple ways that you can log errors in Stackdriver.
Read more >
10 Ways to Take Your Error Logs Up a Level - Coralogix
7. Refine your error logs and error handling together · Are there any error or exception code statements missing associated log statements? ·...
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