Make errors more developer friendly?

Update(Role("user"), {
  membership: {
    resource: Collection("users")
  },
  privileges: [
    {
      resource: Collection("users"),
      actions: {
        read: Query(
          Lambda(
            "ref",
            HasCurrentIdentity()
          )
        ),
        write: Query(
          Lambda(
            ["oldData", "newData", "ref"],
            And(
              Equals(CurrentIdentity(), Var("ref")),
              # we want to make sure that the user cannot change these values
              Equals(
                Select(
                  ["data", "email"],
                  Var('newData')
                ),
                Select(
                  ["data", "email"],
                  Var('oldData')
                )
              )
            )
          )
        )
      }
    },
    {
      resource: Function("logout"),
      actions: {
        call: true
      }
    },
    {
      resource: Function("getUserData"),
      actions: {
        call: true
      }
    },
    {
      resource: Function("searchUsersByName"),
      actions: {
        call: true
      }
    }
  ]
})

What the error is actually talking about is the comment # we want to make sure that the user cannot change these values I’m assuming FQL doesn’t have comments that’s why this error was thrown, but can we at least point which line the error occurred? Similar to what you would have gotten if you were coding in JS or TS or other programming languages.

The web shell is a javascript environment – it uses the JS driver. You can use javascript comments in the web shell.

That error is from javascript itself, indicating a syntax error, and that is not something over which Fauna has control.

1 Like