NextJS error boundaries with server actions

Error boundaries in nextjs appears to be mostly a client-side boundary for returning fallback components (or redirecting) in the event of some failure. But does a similar feature exist for server actions?

I ask because I would like to architect my server actions in such a way that I can write them as throwing exceptions in the event of some error, and centrally catch such errors without necessarily handling all the error conditions inside of each server action endpoint. Somewhat functionally equivalent to how you might architect your conventional backend code with middleware or something similar.

Functionally this is what I am trying to achieve, but I would rather be able to support it without routing all my server actions through a single endpoint:

'use server'

const RPCArray = {
    GET_DATA: (args) => {
        if (!args)
            throw new Error('No good')
        return {}
    },

    PUT_DATA: (args) => {
        if (!args)
            throw new Error('No good')
        return {}
    }
}

export async function doServerRPC(which: string, ...args: any): Promise<any> {
    try {
        return RPCArray[which](args)
    } catch (e: any) {
        return {
            message: e.message || 'An unknown error ocurred'
        }
    }
}

Where client code can do e.g.

const resp = doServerRPC('GET_DATA')

It would be most ideal if the feature were somehow built into the server action infrastructure and I need’nt serialize all my server actions through single endpoint. I was looking at error boundaries to see if error.tsx would apply but I don’t think it does.

Is there another way of doing this without forcing each server action to have a try/catch like I’ve shown in doServerRPC above?

In the event that this is not possible with nextjs, what sort of language features might help facilitate it? Can you, for instance, register exception handlers on a per file/module basis?