frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Start all of your commands with a comma (2009)

https://rhodesmill.org/brandon/2009/commands-with-comma/
289•theblazehen•2d ago•95 comments

Software Engineering Is Back

https://blog.alaindichiappari.dev/p/software-engineering-is-back
20•alainrk•1h ago•10 comments

Hoot: Scheme on WebAssembly

https://www.spritely.institute/hoot/
34•AlexeyBrin•1h ago•5 comments

Reinforcement Learning from Human Feedback

https://arxiv.org/abs/2504.12501
14•onurkanbkrc•1h ago•1 comments

OpenCiv3: Open-source, cross-platform reimagining of Civilization III

https://openciv3.org/
717•klaussilveira•16h ago•217 comments

The Waymo World Model

https://waymo.com/blog/2026/02/the-waymo-world-model-a-new-frontier-for-autonomous-driving-simula...
978•xnx•21h ago•562 comments

Vocal Guide – belt sing without killing yourself

https://jesperordrup.github.io/vocal-guide/
94•jesperordrup•6h ago•35 comments

Omarchy First Impressions

https://brianlovin.com/writing/omarchy-first-impressions-CEEstJk
11•tosh•1h ago•8 comments

Making geo joins faster with H3 indexes

https://floedb.ai/blog/how-we-made-geo-joins-400-faster-with-h3-indexes
138•matheusalmeida•2d ago•36 comments

Unseen Footage of Atari Battlezone Arcade Cabinet Production

https://arcadeblogger.com/2026/02/02/unseen-footage-of-atari-battlezone-cabinet-production/
74•videotopia•4d ago•11 comments

Ga68, a GNU Algol 68 Compiler

https://fosdem.org/2026/schedule/event/PEXRTN-ga68-intro/
16•matt_d•3d ago•4 comments

What Is Ruliology?

https://writings.stephenwolfram.com/2026/01/what-is-ruliology/
46•helloplanets•4d ago•46 comments

Show HN: Look Ma, No Linux: Shell, App Installer, Vi, Cc on ESP32-S3 / BreezyBox

https://github.com/valdanylchuk/breezydemo
242•isitcontent•16h ago•27 comments

Monty: A minimal, secure Python interpreter written in Rust for use by AI

https://github.com/pydantic/monty
242•dmpetrov•16h ago•128 comments

Cross-Region MSK Replication: K2K vs. MirrorMaker2

https://medium.com/lensesio/cross-region-msk-replication-a-comprehensive-performance-comparison-o...
4•andmarios•4d ago•1 comments

Show HN: I spent 4 years building a UI design tool with only the features I use

https://vecti.com
344•vecti•18h ago•153 comments

Hackers (1995) Animated Experience

https://hackers-1995.vercel.app/
510•todsacerdoti•1d ago•248 comments

Sheldon Brown's Bicycle Technical Info

https://www.sheldonbrown.com/
393•ostacke•22h ago•101 comments

Show HN: If you lose your memory, how to regain access to your computer?

https://eljojo.github.io/rememory/
309•eljojo•19h ago•192 comments

Microsoft open-sources LiteBox, a security-focused library OS

https://github.com/microsoft/litebox
361•aktau•22h ago•187 comments

An Update on Heroku

https://www.heroku.com/blog/an-update-on-heroku/
437•lstoll•22h ago•286 comments

The AI boom is causing shortages everywhere else

https://www.washingtonpost.com/technology/2026/02/07/ai-spending-economy-shortages/
32•1vuio0pswjnm7•2h ago•31 comments

PC Floppy Copy Protection: Vault Prolok

https://martypc.blogspot.com/2024/09/pc-floppy-copy-protection-vault-prolok.html
73•kmm•5d ago•11 comments

Was Benoit Mandelbrot a hedgehog or a fox?

https://arxiv.org/abs/2602.01122
26•bikenaga•3d ago•13 comments

Dark Alley Mathematics

https://blog.szczepan.org/blog/three-points/
98•quibono•4d ago•22 comments

How to effectively write quality code with AI

https://heidenstedt.org/posts/2026/how-to-effectively-write-quality-code-with-ai/
278•i5heu•19h ago•227 comments

Female Asian Elephant Calf Born at the Smithsonian National Zoo

https://www.si.edu/newsdesk/releases/female-asian-elephant-calf-born-smithsonians-national-zoo-an...
43•gmays•11h ago•14 comments

I now assume that all ads on Apple news are scams

https://kirkville.com/i-now-assume-that-all-ads-on-apple-news-are-scams/
1088•cdrnsf•1d ago•469 comments

Understanding Neural Network, Visually

https://visualrambling.space/neural-network/
312•surprisetalk•3d ago•45 comments

Delimited Continuations vs. Lwt for Threads

https://mirageos.org/blog/delimcc-vs-lwt
36•romes•4d ago•3 comments
Open in hackernews

Implementing Rust newtype for errors in axum

https://rup12.net/posts/learning-rust-custom-errors/
19•ruptwelve•2mo ago

Comments

hobs•2mo ago
Like the post, but the backticks on all sorts of things is very distracting - am I missing some value here?
ruptwelve•2mo ago
I'll chalk that up to my Astro theme. It's supposed to be just `Something` and the backticks should have not been visible! Sorry!
goddtriffin•2mo ago
Great post. I do the same thing for all of my Rust web servers too. I don't use anyhow though, prefer rolling everything myself - which as you call out is a pain after a while.
ruptwelve•2mo ago
`Anyhow` is a great thing to get you started. But ultimately you wanna use some bespoke errors, and just roll your own!
vsgherzi•2mo ago
would you get backtraces with this implementation? I've been increasingly frustrated with axum. It hits my custom error where I print something like "sqlx database failed" but when there's lots of traffic it's hard to determine which of the hundreds of queries actually failed. What I really want is the top part of a backtrace or at least a line number. I know anyhow gives bts but will it actually be useful when used like this?

Anyone else have ideas on how to solve this?

dlahoda•2mo ago
i do not see problems with axum.

we wrote some macro(with muncher) which allows strongly typed and yet dry per method error, error split of public part vs internal log only(with backtrace crate trace capture), full openapi support(via schemars) and we do not use anyhow.

whole article is rot and bad advice.

vsgherzi•2mo ago
mind sharing a link?
dlahoda•2mo ago
used like this

``` pub async fn account_pubkey( GetAccountPubkey { account_id }: GetAccountPubkey, State(st): State<AppState>, ) -> Response!(RegistrationKey; not_found: UserNotFound) { ```

``` pub async fn action( SubmitAction {}: SubmitAction, State(st): State<AppState>, TypedHeader(content_type): TypedHeader<headers::ContentType>, body: axum::body::Bytes, ) -> Result< axum::body::Bytes, ApiError!(unsupported_media_type: AcceptedMediaType, payload_too_large: PayloadTooLarge), > { ```

as you see limitation of ast macro - single entity per code. to do more - need proc macro.

default response is json

``` #[macro_export] macro_rules! Response { ($ty:ty) => { Result<::axum::Json<$ty>, $crate::http::error::Error<()>> }; ($ty:ty; $($var:ident : $e:ty),) => { Result<::axum::Json<$ty>, nord_core::ApiError!($($var : $e),)> }; } ```

use ApiError for other mime types

``` #[macro_export] macro_rules! ApiError { ( $($var:ident : $e:ty),* $(,)? ) => { nord_core::ApiError!({ $($var : $e,)* }) }; () => { $crate::http::error::Error::<()> }; ({ $($var:ident : $e:ty),* $(,)? }) => { nord_core::ApiError!( @internal bad_request: $crate::http::error::Infallible, not_found: $crate::http::error::Infallible, forbidden: $crate::http::error::Infallible, unsupported_media_type: $crate::http::error::Infallible, payload_too_large: $crate::http::error::Infallible, not_implemented: $crate::http::error::Infallible, | $($var : $e,)* ) }; ( @internal bad_request: $bad_request:ty, not_found: $not_found:ty, forbidden: $forbidden:ty, unsupported_media_type: $unsupported_media_type:ty, payload_too_large: $payload_too_large:ty, not_implemented: $not_implemented:ty, | // empty ) => { $crate::http::error::Error<( $bad_request, $not_found, $forbidden, $unsupported_media_type, $payload_too_large, $not_implemented, )> }; ( @internal bad_request: $_:ty, not_found: $not_found:ty, forbidden: $forbidden:ty, unsupported_media_type: $unsupported_media_type:ty, payload_too_large: $payload_too_large:ty, not_implemented: $not_implemented:ty, | bad_request: $bad_request:ty, $($rest:tt)* ) => { nord_core::ApiError!( @internal bad_request: $bad_request, not_found: $not_found, forbidden: $forbidden, unsupported_media_type: $unsupported_media_type, payload_too_large: $payload_too_large, not_implemented: $not_implemented, | $($rest)* ) };

.... crazy a lot of repeated code of recursive tt muncher

```

error can be custom:

``` #[derive(Debug, serde::Serialize, serde::Deserialize, schemars::JsonSchema)] pub struct AcceptedMediaType { pub expected: String, }

impl ExpectedMimeType for AcceptedMediaType { fn expected(&self) -> &str { &self.expected } }

impl AcceptedMediaType { pub fn new(value: headers::ContentType) -> Self { Self { expected: value.to_string(), } } } ```

each method has its own error as needed.

openapi integration ```

impl<ST: StatusTypes> aide::OperationOutput for Error<ST> { type Inner = Self;

    fn inferred_responses(
        cx: &mut aide::generate::GenContext,
        op: &mut aide::openapi::Operation,
    ) -> Vec<(Option<u16>, aide::openapi::Response)> {
        [
            <ST::BadRequest as OperationOutputInternal>::operation_response(cx, op)
                .map(|x| (Some(400), x)),
              ....
            <ST::UnsupportedMediaType as OperationOutputInternal>::operation_response(cx, op).map(
                |mut x| {
                    use aide::openapi::{
                        Header, ParameterSchemaOrContent, ReferenceOr, SchemaObject,
                    };
                    let header = Header {
                        description: Some("Expected request media type".into()),
                        style: Default::default(),
                        required: true,
                        deprecated: None,
                        format: ParameterSchemaOrContent::Schema(SchemaObject {
                            json_schema: schemars::schema::Schema::Object(
                                schemars::schema_for!(String).schema,
                            ),
                            external_docs: None,
                            example: None,
                        }),
                        example: Some(serde_json::json!(
                            mime::APPLICATION_OCTET_STREAM.to_string()
                        )),
                        examples: Default::default(),
                        extensions: Default::default(),
                    };
                    x.headers
                        .insert(header::ACCEPT.to_string(), ReferenceOr::Item(header));
                    (Some(415), x)
                },
            ),
            ...
            <ST::NotImplemented as OperationOutputInternal>::operation_response(cx, op)
                .map(|x| (Some(501), x)),
        ]
        .into_iter()
        .flatten()
        .collect()
    }
} ```

user vs internal errors - tracing:

``` impl<ST: StatusTypes> IntoResponse for Error<ST> where ST: StatusTypes, { fn into_response(self) -> axum::response::Response { let status = self.status_code(); match self { Self::Internal(error) => { let error = &error as &dyn std::error::Error; tracing::error!(error, "internal error during http request"); (status, Json("INTERNAL SERVER ERROR")).into_response() } Self::Forbidden(e) => (status, Json(e)).into_response(), Self::UnsupportedMediaType(e) => { let value = HeaderValue::from_str(e.expected()); let mut resp = (status, Json(e)).into_response(); if let Ok(value) = value { resp.headers_mut().insert(header::ACCEPT, value); } resp } Self::PayloadTooLarge(e) => (status, Json(e)).into_response(), ... } } }

```

and types sugar ``` mod typelevel {

    /// No client error defined; this type can't be constructed.
    #[derive(Debug, Serialize, Deserialize)]
    pub enum Infallible {}

    impl ExpectedMimeType for Infallible {
        fn expected(&self) -> &str {
            unreachable!("Infallible")
        }
    }

    pub trait ExpectedMimeType {
        fn expected(&self) -> &str;
    }

    pub trait StatusTypes {
        type BadRequest: serde::Serialize + OperationOutputInternal;
        type UnsupportedMediaType: serde::Serialize + OperationOutputInternal + ExpectedMimeType;
        ...
    }

    impl StatusTypes for () {
        type BadRequest = Infallible;
        type NotFound = Infallible;
... }

    impl StatusTypes for Infallible {
        type BadRequest = Infallible;
        type NotFound = Infallible;
.. }

    impl<
        BadRequest: serde::Serialize + OperationOutputInternal,
        NotFound: serde::Serialize + OperationOutputInternal,
        Forbidden: serde::Serialize + OperationOutputInternal,
        UnsupportedMediaType: serde::Serialize + OperationOutputInternal + ExpectedMimeType,
        PayloadTooLarge: serde::Serialize + OperationOutputInternal,
        NotImplemented: serde::Serialize + OperationOutputInternal,
    > StatusTypes
        for (
            BadRequest,
            NotFound,
            Forbidden,
            UnsupportedMediaType,
            PayloadTooLarge,
            NotImplemented,
        )
    {
        type BadRequest = BadRequest;
        type NotFound = NotFound;
        type Forbidden = Forbidden;
        type UnsupportedMediaType = UnsupportedMediaType;
        type PayloadTooLarge = PayloadTooLarge;
        type NotImplemented = NotImplemented;
    }
... }

use typelevel::

;

#[derive(Debug)] pub enum Error<ST: StatusTypes> { Internal(Box<dyn std::error::Error + Send + Sync>), BadRequest(ST::BadRequest), ... }

impl std::fmt::Display for Infallible { fn fmt(&self, _: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match *self {} } }

impl<ST: StatusTypes> Error<ST> { pub fn internal(value: impl std::error::Error + Send + Sync + 'static) -> Self { Self::Internal(Box::new(value)) }

    pub fn bad_request(value: ST::BadRequest) -> Self {
        Self::BadRequest(value)
    }

    pub fn not_found(value: ST::NotFound) -> Self {
        Self::NotFound(value)
    }

    pub fn forbidden(value: ST::Forbidden) -> Self {
        Self::Forbidden(value)
    }
```
dlahoda•2mo ago
end result is here https://zo-devnet.n1.xyz/docs - well documented strongly typed errors for API. most eveolved

https://zo-devnet.n1.xyz/docs#tag/default/post/action - mixes binary encoding, headers, and numeric errors embeeding (http goes to binary tx format).

all strongly typed without duplicated boilerplate.

inside - ad hoc error assembly - display_doc,derive_more, backtrace - no anyhow, not thiserror, no snafu.

fail fast and panic a lot, covered by proptests(toward fuzzytests).

used https://github.com/target-san/scoped-panic-hook to catch panics as exceptions.

was thinking to use https://github.com/iex-rs/lithium

panics = bugs or undefinenide behavour.