ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "Dan0042 (Daniel DeLorme) via ruby-core" <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: "Dan0042 (Daniel DeLorme)" <noreply@ruby-lang.org>
Subject: [ruby-core:119742] [Ruby master Feature#20864] Support `error:` keyword to `Kernel#warn`
Date: Tue, 05 Nov 2024 16:14:29 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-110406.20241105161428.3344@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-20864.20241105112127.3344@ruby-lang.org>

Issue #20864 has been updated by Dan0042 (Daniel DeLorme).


I think I agree with the general idea but I'm not sure if the proposal is what I think it is. It's a bit thin about what happens with this "error" keyword exactly. So is the idea that this meta-information would be forwarded to another method to decide what to do with it? Are we talking about extending `Warning.warn` to work like: `warn(*args, **opts)` -> `Warning.warn(formatted_str, **opts)`

----------------------------------------
Feature #20864: Support `error:` keyword to `Kernel#warn`
https://bugs.ruby-lang.org/issues/20864#change-110406

* Author: ioquatix (Samuel Williams)
* Status: Open
----------------------------------------
`Kernel#warn` is extremely useful.

It is possible to include some details about the current caller using `uplevel` for the current call stack. But it is not possible to include details about errors.

I'd like to propose another extension to log errors.

```ruby
begin
  # some work
rescue => error
  warn "An error occurred!", error: error
end
```

Such a feature would allow us to log errors using a standard interface.

I don't have an opinion about the implementation, but I wanted to get feedback on the interface.



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

  parent reply	other threads:[~2024-11-05 16:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05 11:21 [ruby-core:119726] " ioquatix (Samuel Williams) via ruby-core
2024-11-05 12:26 ` [ruby-core:119727] " zverok (Victor Shepelev) via ruby-core
2024-11-05 13:47 ` [ruby-core:119729] " Eregon (Benoit Daloze) via ruby-core
2024-11-05 15:04 ` [ruby-core:119734] " ioquatix (Samuel Williams) via ruby-core
2024-11-05 16:14 ` Dan0042 (Daniel DeLorme) via ruby-core [this message]
2024-11-05 22:05 ` [ruby-core:119754] " ioquatix (Samuel Williams) via ruby-core
2024-11-06 22:26 ` [ruby-core:119785] [Ruby master Feature#20864] Allow `Kernel#warn` to accept `**options` and pass these to `Warning.warn` ioquatix (Samuel Williams) via ruby-core
2024-11-06 23:38 ` [ruby-core:119786] " jeremyevans0 (Jeremy Evans) via ruby-core
2024-11-06 23:53 ` [ruby-core:119787] " ioquatix (Samuel Williams) via ruby-core
2024-11-07  1:26 ` [ruby-core:119788] " ioquatix (Samuel Williams) via ruby-core
2024-11-07  5:56 ` [ruby-core:119790] " ko1 (Koichi Sasada) via ruby-core
2024-11-07  6:09 ` [ruby-core:119791] " ioquatix (Samuel Williams) via ruby-core
2024-11-08  9:00 ` [ruby-core:119837] " shyouhei (Shyouhei Urabe) via ruby-core
2024-11-08 12:26 ` [ruby-core:119841] " Eregon (Benoit Daloze) via ruby-core

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-110406.20241105161428.3344@ruby-lang.org \
    --to=ruby-core@ml.ruby-lang.org \
    --cc=noreply@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).