File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
sources/platform/actors/development/actor_definition/dataset_schema Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ description: Specify the dataset schema within the Actors so you can add monito
4
4
slug : /actors/development/actor-definition/dataset-schema/validation
5
5
---
6
6
7
+ import Tabs from '@theme/Tabs ';
8
+ import TabItem from '@theme/TabItem ';
9
+
7
10
** Specify the dataset schema within the Actors so you can add monitoring and validation at the field level.**
8
11
9
12
---
@@ -105,6 +108,8 @@ The type of the AJV validation error object is [here](https://github.com/ajv-val
105
108
106
109
If you use the Apify JS client or Apify SDK and call ` pushData ` function you can access the validation errors in a ` try catch ` block like this:
107
110
111
+ <Tabs >
112
+ <TabItem value =" Javascript " label =" Javascript " default >
108
113
``` javascript
109
114
try {
110
115
const response = await Actor .pushData (items);
@@ -115,6 +120,17 @@ try {
115
120
});
116
121
}
117
122
` ` `
123
+ </TabItem>
124
+ <TabItem value="Python" label="Python">
125
+ ` ` ` python
126
+ try :
127
+ await Actor .push_data (items)
128
+ except ApifyApiError as error:
129
+ if " invalidItems" in error .data :
130
+ validation_errors = e .data [" invalidItems" ]
131
+ ` ` `
132
+ </TabItem>
133
+ </Tabs>
118
134
119
135
## Examples of common types of validation
120
136
You can’t perform that action at this time.
0 commit comments