Skip to content

Commit 34303e3

Browse files
committed
Add AlwaysWrapErrors flag
1 parent 5b2e255 commit 34303e3

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

boilingcore/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type Config struct {
3131
NoRowsAffected bool `toml:"no_rows_affected,omitempty" json:"no_rows_affected,omitempty"`
3232
NoDriverTemplates bool `toml:"no_driver_templates,omitempty" json:"no_driver_templates,omitempty"`
3333
NoBackReferencing bool `toml:"no_back_reference,omitempty" json:"no_back_reference,omitempty"`
34+
AlwaysWrapErrors bool `toml:"always_wrap_errors,omitempty" json:"always_wrap_errors,omitempty"`
3435
Wipe bool `toml:"wipe,omitempty" json:"wipe,omitempty"`
3536
StructTagCasing string `toml:"struct_tag_casing,omitempty" json:"struct_tag_casing,omitempty"`
3637
RelationTag string `toml:"relation_tag,omitempty" json:"relation_tag,omitempty"`

main.go

+2
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ func main() {
101101
rootCmd.PersistentFlags().BoolP("no-auto-timestamps", "", false, "Disable automatic timestamps for created_at/updated_at")
102102
rootCmd.PersistentFlags().BoolP("no-driver-templates", "", false, "Disable parsing of templates defined by the database driver")
103103
rootCmd.PersistentFlags().BoolP("no-back-referencing", "", false, "Disable back referencing in the loaded relationship structs")
104+
rootCmd.PersistentFlags().BoolP("always-wrap-errors", "", false, "Wrap all returned errors with stacktraces, also sql.ErrNoRows")
104105
rootCmd.PersistentFlags().BoolP("add-global-variants", "", false, "Enable generation for global variants")
105106
rootCmd.PersistentFlags().BoolP("add-panic-variants", "", false, "Enable generation for panic variants")
106107
rootCmd.PersistentFlags().BoolP("add-soft-deletes", "", false, "Enable soft deletion by updating deleted_at timestamp")
@@ -180,6 +181,7 @@ func preRun(cmd *cobra.Command, args []string) error {
180181
NoAutoTimestamps: viper.GetBool("no-auto-timestamps"),
181182
NoDriverTemplates: viper.GetBool("no-driver-templates"),
182183
NoBackReferencing: viper.GetBool("no-back-referencing"),
184+
AlwaysWrapErrors: viper.GetBool("always-wrap-errors"),
183185
Wipe: viper.GetBool("wipe"),
184186
StructTagCasing: strings.ToLower(viper.GetString("struct-tag-casing")), // camel | snake | title
185187
TagIgnore: viper.GetStringSlice("tag-ignore"),

0 commit comments

Comments
 (0)