Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMPROVED] Subject transform validation and error reporting #4202

Merged
merged 2 commits into from Jun 1, 2023

Commits on May 31, 2023

  1. 1: Improves error reporting for weighted mappings:

    As it was, any error in a weighted mapping would return a very unhelpfull error message.
    
    e.g. `nats-server: mappingtest.cfg:38:39: interface conversion: interface {} is []interface {}, not string`
    
    This was because the line `err := &configErr{tk, fmt.Sprintf("Error adding mapping for %q to %q : %v", subj, v.(string), err)}` would panic on the `v.(string)` since in weighted mapping that interface{} is actually a map[string]interface{} (since there's can be more than one mapping in weighted mappings).
    
    Now returns the actual error:
    
    e.g. `nats-server: mappingtest.cfg:40:3: Error adding mapping for "bla" : invalid mapping destination: wildcard index out of range in {{wildcard(1)}}`
    
    2: improves subject transform checking and catches if the destination is using a mapping function and there are no partial wildcards in the source.
    Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
    jnmoyne committed May 31, 2023
    Configuration menu
    Copy the full SHA
    08987bd View commit details
    Browse the repository at this point in the history

Commits on Jun 1, 2023

  1. Harmonize subject mapping error variable names

    Signed-off-by: Jean-Noël Moyne <jnmoyne@gmail.com>
    jnmoyne committed Jun 1, 2023
    Configuration menu
    Copy the full SHA
    0bd3fa4 View commit details
    Browse the repository at this point in the history