Skip to content

Commit

Permalink
return module errors with quoted strings
Browse files Browse the repository at this point in the history
  • Loading branch information
uberesch committed May 23, 2017
1 parent 15a739c commit 028aaa4
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions codegen/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (system *ModuleSystem) RegisterClass(

if system.classes[name] != nil {
return errors.Errorf(
"The module class \"%s\" is already defined",
"The module class %q is already defined",
name,
)
}
Expand All @@ -82,7 +82,7 @@ func (system *ModuleSystem) RegisterClass(
for _, moduleType := range class.ClassDependencies {
if system.classes[moduleType] == nil {
return errors.Errorf(
"The module class \"%s\" depends on class type \"%s\", "+
"The module class %q depends on class type %q, "+
"which is not yet defined",
name,
moduleType,
Expand All @@ -94,7 +94,7 @@ func (system *ModuleSystem) RegisterClass(

if strings.HasPrefix(class.Directory, "..") {
return errors.Errorf(
"The module class \"%s\" must map to an internal directory but was \"%s\"",
"The module class %q must map to an internal directory but was %q",
name,
class.Directory,
)
Expand All @@ -104,7 +104,7 @@ func (system *ModuleSystem) RegisterClass(
for moduleClassName, moduleClass := range system.classes {
if class.Directory == moduleClass.Directory && class.ClassType == moduleClass.ClassType {
return errors.Errorf(
"The module class \"%s\" conflicts with directory \"%s\" from class \"%s\"",
"The module class %q conflicts with directory %q from class %q",
name,
class.Directory,
moduleClassName,
Expand All @@ -130,15 +130,15 @@ func (system *ModuleSystem) RegisterClassType(

if moduleClass == nil {
return errors.Errorf(
"Cannot set class type \"%s\" for undefined class \"%s\"",
"Cannot set class type %q for undefined class %q",
classType,
className,
)
}

if moduleClass.types[classType] != nil {
return errors.Errorf(
"The class type \"%s\" is already defined for class \"%s\"",
"The class type %q is already defined for class %q",
classType,
className,
)
Expand Down Expand Up @@ -178,7 +178,7 @@ func (system *ModuleSystem) ResolveModules(
if instanceErr != nil {
return nil, errors.Wrapf(
instanceErr,
"Error reading single instance \"%s\" in \"%s\"",
"Error reading single instance %q in %q",
className,
class.Directory,
)
Expand All @@ -193,7 +193,7 @@ func (system *ModuleSystem) ResolveModules(
// Expected $path to be a class directory
return nil, errors.Wrapf(
err,
"Error reading module instance directory \"%s\"",
"Error reading module instance directory %q",
fullInstanceDirectory,
)
}
Expand All @@ -210,7 +210,7 @@ func (system *ModuleSystem) ResolveModules(
if instanceErr != nil {
return nil, errors.Wrapf(
instanceErr,
"Error reading multi instance \"%s\" in \"%s\"",
"Error reading multi instance %q in %q",
className,
filepath.Join(class.Directory, file.Name()),
)
Expand All @@ -230,7 +230,7 @@ func (system *ModuleSystem) ResolveModules(

if !ok {
return nil, errors.Errorf(
"Invalid class name \"%q\" in dependencies for %s %s",
"Invalid class name %q in dependencies for %q %q",
classDependency.ClassName,
classInstance.ClassName,
classInstance.InstanceName,
Expand All @@ -249,8 +249,8 @@ func (system *ModuleSystem) ResolveModules(

if dependencyInstance == nil {
return nil, errors.Errorf(
"Unknown %q class depdendency \"%q\""+
"in dependencies for %s %s",
"Unknown %q class depdendency %q"+
"in dependencies for %q %q",
classDependency.ClassName,
classDependency.InstanceName,
classInstance.ClassName,
Expand Down Expand Up @@ -278,7 +278,7 @@ func (system *ModuleSystem) ResolveModules(

if !ok {
return nil, errors.Errorf(
"Invalid class name \"%q\" in dependencies for %s %s",
"Invalid class name %q in dependencies for %q %q",
classDependency.ClassName,
classInstance.ClassName,
classInstance.InstanceName,
Expand All @@ -297,8 +297,8 @@ func (system *ModuleSystem) ResolveModules(

if dependencyInstance == nil {
return nil, errors.Errorf(
"Unknown %q class depdendency \"%q\""+
"in dependencies for %s %s",
"Unknown %q class depdendency %q"+
"in dependencies for %q %q",
classDependency.ClassName,
classDependency.InstanceName,
classInstance.ClassName,
Expand Down Expand Up @@ -345,7 +345,7 @@ func (system *ModuleSystem) readInstance(
// Expected $class-config.json to exist in ...
return nil, errors.Wrapf(
err,
"Error reading JSON Config \"%s\"",
"Error reading JSON Config %q",
classConfigPath,
)
}
Expand All @@ -366,7 +366,7 @@ func (system *ModuleSystem) readInstance(
// Expected $class-config.json to exist in ...
return nil, errors.Wrapf(
err,
"Error reading class package info for %s %s",
"Error reading class package info for %q %q",
className,
jsonConfig.Name,
)
Expand Down Expand Up @@ -427,7 +427,7 @@ func readPackageInfo(
if err != nil {
return nil, errors.Wrapf(
err,
"Error computing generated import string for %s",
"Error computing generated import string for %q",
targetGenDir,
)
}
Expand Down Expand Up @@ -523,7 +523,7 @@ func (system *ModuleSystem) GenerateBuild(

if err != nil {
fmt.Printf(
"Error generating %q %q class of type %q\n%s\n",
"Error generating %q %q class of type %q\n%q\n",
classInstance.InstanceName,
classInstance.ClassName,
classInstance.ClassType,
Expand Down

0 comments on commit 028aaa4

Please sign in to comment.