Skip to content

Template error can be interpreted incorrectly because of bad error message #729

@BitPuffin

Description

@BitPuffin
import db_sqlite

var db = Open(connection="foo.db", user="rumpf", password="fpmur", database="mydb")

proc getFromWhere*(id, row, table: string): TRow =
  result = db.getRow(sql"select 1 from ? where ? = ?", table, row, id)

template getFrom*(id, table: string): expr =
  getFromWhere(id, "id", table)
  ## foo! this line causes error

discard "4".getFrom("users") # Should raise exception (because table users dosen't \
                                          # exist and neither does user 4) but doesn't compile

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions