Skip to content

Commit 285fd97

Browse files
committed
tweak type error message; add acc test for it
1 parent 4b8ebe5 commit 285fd97

File tree

9 files changed

+54
-2
lines changed

9 files changed

+54
-2
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
resources:
2+
jobs:
3+
bar:
4+
name: job bar
5+
foo:
6+
name: job foo
7+
tasks:
8+
- task_key: job_task
9+
run_job_task:
10+
job_id: ${resources.jobs.bar.name}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
>>> musterr [CLI] bundle plan
3+
Error: cannot plan resources.jobs.foo: cannot update tasks[0].run_job_task.job_id with value of "${resources.jobs.bar.name}": cannot set (*jobs.JobSettings).tasks[0].run_job_task.job_id to string ("job bar"): cannot parse "job bar" as int64: strconv.ParseInt: parsing "job bar": invalid syntax
4+
5+
Error: planning failed
6+
7+
8+
Exit code (musterr): 1
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
>>> musterr [CLI] bundle plan
3+
Error: exit status 1
4+
5+
Error: Incorrect attribute value type
6+
7+
on bundle.tf.json line 43, in resource.databricks_job.foo.task[0].run_job_task:
8+
43: "job_id": "${databricks_job.bar.name}"
9+
├────────────────
10+
│ databricks_job.bar.name is "job bar"
11+
12+
Inappropriate value for attribute "job_id": a number is required.
13+
14+
15+
16+
Exit code (musterr): 1
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"method": "GET",
3+
"path": "/api/2.0/preview/scim/v2/Me"
4+
}
5+
{
6+
"method": "GET",
7+
"path": "/api/2.0/workspace/get-status"
8+
}
9+
{
10+
"method": "GET",
11+
"path": "/api/2.0/workspace/get-status"
12+
}

acceptance/bundle/resource_deps/bad_ref_string_to_int/out.test.toml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

acceptance/bundle/resource_deps/bad_ref_string_to_int/output.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
trace musterr $CLI bundle plan &> out.plan.$DATABRICKS_BUNDLE_ENGINE.txt

bundle/direct/bundle_plan.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ func (b *DeploymentBundle) resolveReferences(ctx context.Context, entry *deployp
332332

333333
err = entry.NewState.ResolveRef(ref, value)
334334
if err != nil {
335-
logdiag.LogError(ctx, fmt.Errorf("%s: cannot update %s with value of %q = %T %v: %w", errorPrefix, fieldPathStr, ref, value, value, err))
335+
logdiag.LogError(ctx, fmt.Errorf("%s: cannot update %s with value of %q: %w", errorPrefix, fieldPathStr, ref, err))
336336
return false
337337
}
338338
}

libs/structs/structvar/structvar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (sv *StructVar) ResolveRef(reference string, value any) error {
4848
// Pure reference - use original typed value
4949
err = structaccess.Set(sv.Config, pathNode, value)
5050
if err != nil {
51-
return fmt.Errorf("cannot set (%T).%s to %T (%#v): %w\nsv.Config = %#v", sv.Config, pathNode.String(), value, value, err, sv.Config)
51+
return fmt.Errorf("cannot set (%T).%s to %T (%#v): %w", sv.Config, pathNode.String(), value, value, err)
5252
}
5353
// Remove the fully resolved reference
5454
delete(sv.Refs, pathKey)

0 commit comments

Comments
 (0)