@@ -11,12 +11,15 @@ class DuplicateSlotContentError < StandardError
1111 "which means that ViewComponent doesn't know which content to use.\n \n " \
1212 "To fix this issue, use either `with_content` or a block."
1313
14+ # @param klass_name [String] the name of the component class
1415 def initialize ( klass_name )
1516 super ( MESSAGE . gsub ( "COMPONENT" , klass_name . to_s ) )
1617 end
1718 end
1819
1920 class TemplateError < StandardError
21+ # @param errors [Array<String>] the list of template errors
22+ # @param templates [Array, nil] the associated templates
2023 def initialize ( errors , templates = nil )
2124 message = errors . join ( "\n " )
2225
@@ -33,6 +36,7 @@ class MissingPreviewTemplateError < StandardError
3336 "A preview template for example EXAMPLE doesn't exist.\n \n " \
3437 "To fix this issue, create a template for the example."
3538
39+ # @param example [String] the name of the preview example
3640 def initialize ( example )
3741 super ( MESSAGE . gsub ( "EXAMPLE" , example ) )
3842 end
@@ -43,6 +47,8 @@ class MissingTemplateError < StandardError
4347 "No templates for COMPONENT match the request DETAIL.\n \n " \
4448 "To fix this issue, provide a suitable template."
4549
50+ # @param component [String] the component identifier
51+ # @param request_detail [Object] the request detail constraints
4652 def initialize ( component , request_detail )
4753 detail = {
4854 locale : request_detail . locale ,
@@ -60,6 +66,7 @@ class DuplicateContentError < StandardError
6066 "which means that ViewComponent doesn't know which content to use.\n \n " \
6167 "To fix this issue, use either `with_content` or a block."
6268
69+ # @param klass_name [String] the name of the component class
6370 def initialize ( klass_name )
6471 super ( MESSAGE . gsub ( "COMPONENT" , klass_name . to_s ) )
6572 end
@@ -72,6 +79,8 @@ class MissingCollectionArgumentError < StandardError
7279 "To fix this issue, update the initializer to accept `PARAMETER`.\n \n " \
7380 "See [the collections docs](https://viewcomponent.org/guide/collections.html) for more information on rendering collections."
7481
82+ # @param klass_name [String] the name of the component class
83+ # @param parameter [Symbol] the missing collection parameter
7584 def initialize ( klass_name , parameter )
7685 super ( MESSAGE . gsub ( "COMPONENT" , klass_name . to_s ) . gsub ( "PARAMETER" , parameter . to_s ) )
7786 end
@@ -82,6 +91,8 @@ class ReservedParameterError < StandardError
8291 "COMPONENT initializer can't accept the parameter `PARAMETER`, as it will override a " \
8392 "public ViewComponent method. To fix this issue, rename the parameter."
8493
94+ # @param klass_name [String] the name of the component class
95+ # @param parameter [Symbol] the reserved parameter name
8596 def initialize ( klass_name , parameter )
8697 super ( MESSAGE . gsub ( "COMPONENT" , klass_name . to_s ) . gsub ( "PARAMETER" , parameter . to_s ) )
8798 end
@@ -99,6 +110,7 @@ class ContentSlotNameError < StandardError
99110 "Content passed to a ViewComponent as a block is captured and assigned to the `content` accessor without having to create an explicit slot.\n \n " \
100111 "To fix this issue, either use the `content` accessor directly or choose a different slot name."
101112
113+ # @param klass_name [String] the name of the component class
102114 def initialize ( klass_name )
103115 super ( MESSAGE . gsub ( "COMPONENT" , klass_name . to_s ) )
104116 end
@@ -120,6 +132,8 @@ class SlotPredicateNameError < InvalidSlotNameError
120132 "methods ending in `?`.\n \n " \
121133 "To fix this issue, choose a different name."
122134
135+ # @param klass_name [String] the name of the component class
136+ # @param slot_name [Symbol] the invalid slot name
123137 def initialize ( klass_name , slot_name )
124138 super ( MESSAGE . gsub ( "COMPONENT" , klass_name . to_s ) . gsub ( "SLOT_NAME" , slot_name . to_s ) )
125139 end
@@ -130,6 +144,8 @@ class RedefinedSlotError < StandardError
130144 "COMPONENT declares the SLOT_NAME slot multiple times.\n \n " \
131145 "To fix this issue, choose a different slot name."
132146
147+ # @param klass_name [String] the name of the component class
148+ # @param slot_name [Symbol] the redefined slot name
133149 def initialize ( klass_name , slot_name )
134150 super ( MESSAGE . gsub ( "COMPONENT" , klass_name . to_s ) . gsub ( "SLOT_NAME" , slot_name . to_s ) )
135151 end
@@ -140,6 +156,8 @@ class ReservedSingularSlotNameError < InvalidSlotNameError
140156 "COMPONENT declares a slot named SLOT_NAME, which is a reserved word in the ViewComponent framework.\n \n " \
141157 "To fix this issue, choose a different name."
142158
159+ # @param klass_name [String] the name of the component class
160+ # @param slot_name [Symbol] the reserved slot name
143161 def initialize ( klass_name , slot_name )
144162 super ( MESSAGE . gsub ( "COMPONENT" , klass_name . to_s ) . gsub ( "SLOT_NAME" , slot_name . to_s ) )
145163 end
@@ -150,6 +168,8 @@ class ReservedPluralSlotNameError < InvalidSlotNameError
150168 "COMPONENT declares a slot named SLOT_NAME, which is a reserved word in the ViewComponent framework.\n \n " \
151169 "To fix this issue, choose a different name."
152170
171+ # @param klass_name [String] the name of the component class
172+ # @param slot_name [Symbol] the reserved slot name
153173 def initialize ( klass_name , slot_name )
154174 super ( MESSAGE . gsub ( "COMPONENT" , klass_name . to_s ) . gsub ( "SLOT_NAME" , slot_name . to_s ) )
155175 end
@@ -160,6 +180,8 @@ class UncountableSlotNameError < InvalidSlotNameError
160180 "COMPONENT declares a slot named SLOT_NAME, which is an uncountable word\n \n " \
161181 "To fix this issue, choose a different name."
162182
183+ # @param klass_name [String] the name of the component class
184+ # @param slot_name [Symbol] the uncountable slot name
163185 def initialize ( klass_name , slot_name )
164186 super ( MESSAGE . gsub ( "COMPONENT" , klass_name . to_s ) . gsub ( "SLOT_NAME" , slot_name . to_s ) )
165187 end
@@ -168,6 +190,7 @@ def initialize(klass_name, slot_name)
168190 class ContentAlreadySetForPolymorphicSlotError < StandardError
169191 MESSAGE = "Content for slot SLOT_NAME has already been provided."
170192
193+ # @param slot_name [Symbol] the polymorphic slot name
171194 def initialize ( slot_name )
172195 super ( MESSAGE . gsub ( "SLOT_NAME" , slot_name . to_s ) )
173196 end
@@ -215,6 +238,8 @@ class AlreadyDefinedPolymorphicSlotSetterError < StandardError
215238 "A method called 'SETTER_METHOD_NAME' already exists and would be overwritten by the 'SETTER_NAME' polymorphic " \
216239 "slot setter.\n \n Please choose a different setter name."
217240
241+ # @param setter_method_name [Symbol] the existing method name
242+ # @param setter_name [Symbol] the polymorphic slot setter name
218243 def initialize ( setter_method_name , setter_name )
219244 super ( MESSAGE . gsub ( "SETTER_METHOD_NAME" , setter_method_name . to_s ) . gsub ( "SETTER_NAME" , setter_name . to_s ) )
220245 end
0 commit comments