• 1.21K Posts
  • 1K Comments
Joined 3 years ago
cake
Cake day: June 11th, 2023

help-circle











  • Diese “Effektivkosten von 1,5 Prozent pro Jahr” sind doch nicht wirklich Provision? Der Artikel rechnet aus, dass diese zu 100.000€ Mehrkosten führt, aber Provisionen für solche Verträge sind meinens Wissens im nur im vierstelligen Bereich. Ich kenn es eher, dass man in den ersten paar Jahren noch was draufzahlt, aber nicht über die gesamte Laufzeit.

    Diese Kosten über die gesamte Laufzeit gibt es auch, aber da wird nicht mit Provision argumentiert, sondern mit aktiven Fondsmanagement.











  • I just optimized the context messages and I’m now happy with:

    Error: Execute command: redo workspace/motd.json
    
    Caused by:
        0: using sqlite db 'workspace/.redo3.db'
        1: clear dependencies for motd.json
        2: attempt to write a readonly database
        3: Error code 8: attempt to write a readonly database
    

    The “0” context is especially important because it tells you which file is read-only. Here is the code for that:

    pub(crate) fn start(mut self) -> Result<DoFileExecution> {
        let rc_folder = self.target.path.parent().unwrap_or(Utf8Path::new("."));
        let mut db = Db::try_open(rc_folder);
        db.transaction(|tx| {
            tx.clear_dependencies(self.target.basename())
                .with_context(|| format!("using sqlite db '{}'", rc_folder.join(DB_FILENAME)))
        })?;
    
        let now = chrono::Utc::now();
        ...
    

    I don’t think something like “failed to clear dependencies using sqlite db ‘{}’” would be helpful. Something like “failed to” or “error when” does not really add any information. Just describe what is happening. Also, the “clear dependencies” would be redundant because that function can handle that part itself (see msg 1).


  • Since context is kind of on topic, what should one write there? Are there any principles for writing good context messages?

    fn beebboop() {
        foo();
        bar().context("frobnicating");
        baz();
    }
    

    Instead of “frobnicating” in this rough example, I could also write that we intend to “baz” afterwards or that we are “currently beebbooping” or “bar failed” or I could even mention “foo” or …

    From my (rather limited) experience, it seems most useful to describe what beebboop is about to do. Sometimes that is weird though, because then the context for foo, bar, and baz calls would be essentially the same.